A method and device for obtaining a target network model based on shallow compressed features
The method of obtaining the target network model by shallow compression of features, and by using feature extraction and parameter adjustment of teacher and student network models, solves the application limitations of deep learning models on small devices, and achieves performance improvement and resource optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTHWEAT UNIV OF SCI & TECH
- Filing Date
- 2023-03-17
- Publication Date
- 2026-04-17
AI Technical Summary
The complexity and hardware requirements of deep learning network models limit their application on miniaturized devices, making them unsuitable for use on small devices such as smartphones and drones.
By obtaining the teacher network model and the student network model, shallow feature sets are extracted using the training dataset, and channel compression and texture feature extraction are performed. The parameters of the student network model are then adjusted to obtain the target network model.
It effectively reduces the amount of data in the network model, improves performance, and does not increase parameters, making it suitable for miniaturized devices.
Smart Images

Figure CN116151328B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence algorithm technology, and in particular to a method and apparatus for obtaining a target network model based on shallow compressed features. Background Technology
[0002] As the application areas of deep learning continue to expand, the functional complexity of deep learning network models is also increasing. Although the accuracy of recognition or classification using this network model has improved, the structure and capacity of the model are constantly increasing, and the hardware requirements for its use are also becoming more complex. Therefore, it cannot be applied to miniaturized products, such as smartphones and drones.
[0003] Therefore, how to reduce the complexity of network models while ensuring their performance is a pressing technical problem that needs to be solved. Summary of the Invention
[0004] In view of the above problems, the present invention is proposed to provide a method and apparatus for obtaining a target network model based on shallow compressed features to overcome or at least partially solve the above problems.
[0005] In a first aspect, the present invention provides a method for obtaining a target network model based on shallow compressed features, comprising:
[0006] Obtain the teacher network model, the student network model, and the training dataset, wherein the student network model is a simplified version of the teacher network model;
[0007] Based on the training dataset, the student network model is trained to extract a first shallow feature set, and the teacher network model is trained to extract a second shallow feature set.
[0008] Channel compression is performed on the first shallow feature set to obtain a first compressed feature, and channel compression is performed on the second shallow feature set to obtain a second compressed feature;
[0009] The first texture feature information is extracted from the first compressed feature using a texture feature extraction method, and the second texture feature information is extracted from the second compressed feature using the same method.
[0010] Based on the first texture feature information and the second texture feature information, the parameters of the student network model are adjusted to obtain the target network model.
[0011] Preferably, the step of training the student network model and extracting a first shallow feature set based on the training dataset, and training the teacher network model and extracting a second shallow feature set, includes:
[0012] Based on the training dataset, the student network model is trained, and a first shallow feature set is extracted before the first downsampling of the student network model.
[0013] Based on the training dataset, the teacher network model is trained, and a second shallow feature set is extracted before the first downsampling of the teacher network model.
[0014] Preferably, the step of performing channel compression on the first shallow feature set to obtain a first compressed feature, and performing channel compression on the second shallow feature set to obtain a second compressed feature, includes:
[0015] Obtain the first standard deviation of each channel dimension in the first shallow feature set and the second standard deviation of each channel dimension in the second shallow feature set;
[0016] Based on the first standard deviation, determine the first weight of each channel in the first shallow feature set, and based on the second standard deviation, determine the second weight of each channel in the second shallow feature set.
[0017] Based on the first weight and the first shallow feature set, a first compressed feature is obtained from the student network model, and based on the second weight and the second shallow feature set, a second compressed feature is obtained from the teacher network model.
[0018] Preferably, the step of extracting first texture feature information from the first compressed feature using a texture feature extraction method, and extracting second texture feature information from the second compressed feature using the same method, includes:
[0019] Based on the preset size local features of the first compression feature, a first GLBP kernel is determined, and based on the preset size local features of the second compression feature, a second GLBP kernel is determined.
[0020] Based on the first GLBP kernel, the first texture feature information extracted from the first compressed feature is obtained, and based on the second GLBP kernel, the second texture feature information extracted from the second compressed feature is obtained.
[0021] Preferably, adjusting the parameters of the student network model based on the first texture feature information and the second texture feature information to obtain the target network model includes:
[0022] The shallow texture loss is determined based on the first texture feature and the second texture feature;
[0023] Based on the shallow texture loss, the parameters of the student network model are adjusted to obtain the target network model.
[0024] Preferably, adjusting the parameters of the student network model based on the shallow texture loss to obtain the target network model includes:
[0025] Obtain the cross-loss entropy loss between the final output of the student network model and the real target, and the distillation loss between the final output of the student network model and the final output of the teacher network model;
[0026] Based on the shallow texture loss, the cross loss entropy loss, and the distillation loss, the parameters of the student network model are adjusted to obtain the target network model.
[0027] Preferably, the step of adjusting the parameters of the student network model based on the shallow texture loss, the cross-loss entropy loss, and the distillation loss to obtain the target network model includes:
[0028] The total network loss is determined according to the following formula, based on the shallow texture loss, the cross loss entropy loss, and the distillation loss;
[0029] L Total =αL CE +βL KD +γL SeKD
[0030] Among them, L Total L is the total loss of the network. CE For the crossover loss entropy loss, L KD For the distillation loss, L SeKD The shallow texture loss is represented by α, β, and γ, which are hyperparameters used to adjust the balance.
[0031] Based on the total network loss, the parameters of the student network model are adjusted to obtain the target network model.
[0032] Secondly, the present invention also provides an apparatus for obtaining a target network model based on shallow compressed features, comprising:
[0033] The acquisition module is used to acquire the teacher network model, the student network model, and the training dataset, wherein the student network model is a simplified version of the teacher network model.
[0034] The first extraction module is used to train the student network model based on the training dataset to extract a first shallow feature set, and to train the teacher network model to extract a second shallow feature set.
[0035] A compression module is used to perform channel compression on the first shallow feature set to obtain a first compressed feature, and to perform channel compression on the second shallow feature set to obtain a second compressed feature;
[0036] The second extraction module is used to extract first texture feature information from the first compressed feature using a texture feature extraction method, and to extract second texture feature information from the second compressed feature using the same method.
[0037] The module is used to adjust the parameters of the student network model based on the first texture feature information and the second texture feature information to obtain the target network model.
[0038] Thirdly, the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the program to implement the steps of the method described in the first aspect.
[0039] Fourthly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that the program, when executed by a processor, implements the steps of the method described in the first aspect.
[0040] One or more technical solutions in the embodiments of the present invention have at least the following technical effects or advantages:
[0041] This invention provides a method for obtaining a target network model based on shallow compressed features, comprising: obtaining a teacher network model, a student network model, and a training dataset, wherein the student network model is a simplified version of the teacher network model; training the student network model based on the training dataset to extract a first shallow feature set, and training the teacher network model to extract a second shallow feature set; performing channel compression on the first shallow feature set to obtain a first compressed feature, and performing channel compression on the second shallow feature set to obtain a second compressed feature; extracting first texture feature information from the first compressed feature using a texture feature extraction method, and extracting second texture feature information from the second compressed feature using a texture feature extraction method; adjusting the parameters of the student network model based on the first and second texture feature information to obtain the target network model. This method effectively reduces the amount of data by compressing channels, improving performance without increasing the parameters of the network model. Attached Figure Description
[0042] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference figures denote the same parts throughout the drawings. In the drawings:
[0043] Figure 1 This invention illustrates a flowchart of the method for obtaining a target network model based on shallow compression features in an embodiment of the present invention.
[0044] Figure 2 A schematic diagram of the compression features according to an embodiment of the present invention is shown;
[0045] Figure 3 A schematic diagram of the GLBP processing procedure in an embodiment of the present invention is shown;
[0046] Figure 4 A schematic diagram of nine modes in an embodiment of the present invention is shown;
[0047] Figure 5 This invention illustrates an apparatus for obtaining a target network model based on shallow compression features in an embodiment of the present invention;
[0048] Figure 6 A schematic diagram of the structure of a computer device for implementing a method for obtaining a target network model based on shallow compressed features is shown in an embodiment of the present invention. Detailed Implementation
[0049] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0050] Example 1
[0051] Embodiments of the present invention provide a method for obtaining a target network model based on shallow compressed features, such as... Figure 1 As shown, it includes:
[0052] S101, Obtain the teacher network model, student network model and training dataset. The student network model is a simplified version of the teacher network model.
[0053] S102, Based on the training dataset, train the student network model and extract the first shallow feature set, and train the teacher network model and extract the second shallow feature set;
[0054] S103, perform channel compression on the first shallow feature set to obtain the first compressed feature, and perform channel compression on the second shallow feature set to obtain the second compressed feature;
[0055] S104, the first texture feature information is extracted by the texture feature extraction method for the first compressed feature, and the second texture feature information is extracted by the texture feature extraction method for the second compressed feature;
[0056] S105, Based on the first texture feature information and the second texture feature information, the parameters of the student network model are adjusted to obtain the target network model.
[0057] First, the teacher network model is a trained model, while the student network model is an untrained model. The teacher network model consists of multiple functional blocks, each containing multiple structural layers. The student network model has the same structure as the teacher network model, but it has fewer parameters.
[0058] The training dataset is a preprocessed dataset, including random horizontal flipping, random cropping to 32×32, and regularization. The batch_size is set to 64, resulting in the preprocessed training dataset x. Where 64 represents the number of images in the training dataset, 3 represents the number of image channels, and 32*32 represents the image size.
[0059] This invention uses the ResNet56 teacher model structure as an example. The student network model uses ResNet20 as an example, defining an SGD optimizer with an initial learning rate of 0.05, momentum of 0.9, and weight decay of 5 × 10⁻⁶. -4 The total number of training iterations was 240, with the learning rate reduced to one-tenth of the current learning rate at the 150th, 180th, and 210th iterations, respectively.
[0060] Next, S102 is executed, which trains the student network model based on the training dataset to extract the first shallow feature set, and trains the teacher network model to extract the second shallow feature set.
[0061] Specifically, the training dataset is input into the student network model and the teacher network model. The first shallow feature set is extracted before the first downsampling of the student network model, and the second shallow feature set is extracted before the first downsampling of the teacher network model.
[0062] Let 's' denote students and 't' denote teachers. Since the first dimension of the training dataset, the number of images (batch_size), does not change during the network's forward propagation, only the changes in the latter three dimensions are considered. Therefore, the resulting first shallow feature set is labeled as follows: The second shallow layer feature set is labeled as
[0063] As neural networks deepen, the focus shifts from texture information to semantic information. Therefore, texture features are extracted from the output features before the first downsampling. Specifically, this can be done after the first pooling layer, depending on the specific network model.
[0064] Next, S103 is executed to perform channel compression on the first shallow feature set to obtain the first compressed feature, and channel compression on the second shallow feature set to obtain the second compressed feature.
[0065] Specifically, such as Figure 2 As shown, the first standard deviation of each channel dimension in the first shallow feature set and the second standard deviation of each channel dimension in the second shallow feature set are obtained respectively.
[0066] Based on the first standard deviation, the first weight of each channel in the first shallow feature set is determined, and based on the second standard deviation, the second weight of each channel in the second shallow feature set is determined.
[0067] Based on the first weight and the first shallow feature set, the first compressed feature extracted from the student network model is obtained, and based on the second weight and the second shallow feature set, the second compressed feature extracted from the teacher network model is obtained.
[0068] In a specific implementation, the first shallow feature set Second shallow feature set The data is input separately into the texture attention module for processing and calculation, with x for each channel. i Standard deviation Where C is the number of channels; the standard deviation of each channel is used to calculate the channel weight using softmax. Specifically:
[0069]
[0070] Finally, the first shallow feature set is added to the weights corresponding to each channel to obtain the first compressed features extracted from the student network model. The second shallow feature set is weighted and added to the weights corresponding to each channel to obtain the second compressed features extracted from the teacher network model.
[0071] Specific calculation formula:
[0072]
[0073] Through compression, the first compression feature and the second compression feature that can be obtained are:
[0074] Next, S104 is executed to extract the first texture feature information from the first compressed feature using the texture feature extraction method, and to extract the second texture feature from the second compressed feature using the texture feature extraction method.
[0075] Specifically, a first GLBP kernel is determined based on the local features of the preset size of the first compression feature, and a second GLBP kernel is determined based on the local features of the preset size of the second compression feature;
[0076] Based on the first GLBP kernel, the first texture feature information extracted from the first compressed feature is obtained, and based on the second GLBP kernel, the second texture feature information extracted from the second compressed feature is obtained.
[0077] The texture feature extraction method here is specifically Gradient Local Binary Pattern. For example... Figure 3 As shown, taking the local features of a 3*3 region as an example, the feature value of the central region is used as the reference value (120). The feature values of the surrounding 8 feature regions are reassigned, that is, the feature values of these 8 feature regions are compared with the reference value. If the feature value is greater than the reference value, it is assigned a value of 1; otherwise, it is assigned a value of 0. Thus, a binary mode, namely the GLBP mode, is obtained. Regions in the GLBP mode with consecutive 1s are assigned the reciprocal of the consecutive count, and regions with consecutive 0s are assigned the inverse of the reciprocal of the consecutive count. For example, Figure 3 In the GLBP pattern shown, the number of consecutive 1s is 5, therefore its reciprocal is 1 / 5; the number of consecutive 0s is 3, therefore its reciprocal is 1 / 3; and the opposite number is -1 / 3. Thus, the GLBP kernel is obtained. Specifically, the first GLBP kernel corresponds to the first compression feature, and the second GLBP kernel corresponds to the first compression feature.
[0078] Since GLBP only considers the "equivalent patterns" mentioned in LBP, that is, there are only two transitions from 0 to 1 or from 1 to 0 in the pattern, all "0" regions and "1" regions are continuous, and the patterns of all 0 and all 1 are not considered, there are a total of 56 patterns.
[0079] These 56 types were obtained in the following manner:
[0080] Considering rotation invariance, all equivalent modes are reduced to nine. For example... Figure 4 As shown, hollow squares represent 0 in the pattern, and solid squares represent 1 in the pattern. The characteristic of these 9 patterns is that the 0 and 1 regions are continuous, and the changes from 0 to 1 and from 1 to 0 only occur twice when traversing the entire pattern.
[0081] If we only consider the above 9 patterns, ignoring rotation invariance and the patterns of all 0s and all 1s, then there are 7 equivalent patterns remaining. Each of these 7 moduli can be rotated to obtain new patterns. Since there are 8 possible positions for 0s and 1s, each equivalent pattern is expanded into 8 new patterns through rotation. Taking pattern number 1 as an example, the hollow circle will produce a new pattern for each different position, resulting in a total of 8 possible positions. Therefore, pattern number 1 can be expanded into 8 patterns, and so on for the other patterns. Thus, there are a total of 7 × 8 = 56 patterns. These 56 patterns correspond to 56 kernels.
[0082] Next, based on the first GLBP kernel, each channel image in the first compressed feature is convolved using 56 different kernels. Each kernel convolution yields one image, so for one channel image, 56 kernels can produce 56 images. Similarly, based on the second GLBP kernel, each channel image in the second compressed feature is convolved using 56 different kernels, so for one channel image, 56 kernels can produce 56 images. Without compression, there would be 64 channels of features, requiring 64 × 56 to produce 3,000 channel images, which would consume a significant amount of computing and storage resources. Therefore, the channel compression method in this invention reduces the number of channels to 1, ultimately requiring only 1 × 56 feature images to be processed, greatly reducing the processing load.
[0083] This yields texture feature information, that is, the first texture feature information is extracted from the first compressed feature. Extract second texture feature information from the second compression feature.
[0084] Finally, step S105 is executed to adjust the parameters of the student network model based on the first and second texture feature information to obtain the target network model.
[0085] Specifically, the cross-loss entropy loss between the final output of the student network model and the real target, and the distillation loss between the final output of the student network model and the final output of the teacher network model are obtained.
[0086] The parameters of the student network model are adjusted based on shallow texture loss, cross loss, entropy loss, and distillation loss to obtain the target network model.
[0087] The total network loss is determined using the following formula, based on shallow texture loss, cross-entropy loss, and distillation loss:
[0088] L Total =αL CE +βL KD +γL SeKD
[0089] Among them, L Total For the total network loss, L CE For cross-loss and entropy loss, L KD For distillation losses, L SeKD α represents the shallow texture loss, and β and γ are hyperparameters used to adjust the balance.
[0090] Based on the network loss, the parameters of the student network model are adjusted to obtain the target network model.
[0091] The method for obtaining shallow texture loss is as follows:
[0092] By calculating the first texture feature information With second texture feature information The Euclidean distance is used to obtain the shallow texture loss.
[0093]
[0094] The distillation loss L between the final output of the student network model and the final output of the teacher network model. KD Calculation method:
[0095]
[0096] Where τ represents the temperature hyperparameter used to soften the network output, KL(·,·) represents the Kullback-Leibler divergence between the two distributions, and Ψ s (·) and Ψ t (·) represent the logical values output by the student network model and the teacher network model, respectively.
[0097] The cross-loss and entropy loss L between the final output of the student network model and the real target CE Calculation method:
[0098]
[0099] Where y i Indicates the corresponding sample x i The true label.
[0100] After determining the total network loss, backpropagation is performed to update the parameters of the student network model, thereby obtaining the target network model.
[0101] Finally, the obtained target network model is deployed on the development board, and its inference accuracy, inference speed, and storage and computing resource consumption are compared with the teacher's network model. This serves as a validation of the target network model. The significantly reduced hardware computing and storage resource requirements allow the technical solution of this invention to be used in network architectures of varying capacities.
[0102] For example, to verify the effectiveness of this shallow texture distillation, the existing face recognition model MobileFaceNet was further compressed, significantly reducing the model size and computational overhead while still retaining some performance.
[0103] MobileFaceNet is a face recognition model designed for high-precision real-time face verification on mobile and embedded devices, achieving a recognition accuracy of 99.5% on the LFW dataset. By compressing the number of channels in MobileFaceNet to one-eighth of its original size, it retains over 92% recognition accuracy on the LFW dataset.
[0104] Specifically, the MobileFaceNet model was trained using the CASIA-WebFace dataset. The number of channels in the selected MobileFaceNet was reduced to one-eighth of the original number through channel pruning, and recorded as MobileFaceNet (×0.125). The trained MobileFaceNet model was used as the teacher network model, and the compressed MobileFaceNet (×0.125) model was used as the student network model. The shallow texture knowledge distillation method was used to train MobileFaceNet (×0.125) using the CASIA-WebFace dataset, and the model was tested using the LFW dataset.
[0105] Finally, the compression effect of the MobileFaceNet model was tested using the LFW dataset. As shown in the table below, after 8x compression, the MobileFaceNet (×0.125) model only requires 3.5MB of resources during computation and maintains a 92.03% recognition accuracy. See the table below for details:
[0106]
[0107] One or more technical solutions in the embodiments of the present invention have at least the following technical effects or advantages:
[0108] This invention provides a method for obtaining a target network model based on shallow compressed features, comprising: obtaining a teacher network model, a student network model, and a training dataset, wherein the student network model is a simplified version of the teacher network model; training the student network model based on the training dataset to extract a first shallow feature set, and training the teacher network model to extract a second shallow feature set; performing channel compression on the first shallow feature set to obtain a first compressed feature, and performing channel compression on the second shallow feature set to obtain a second compressed feature; extracting first texture feature information from the first compressed feature using a texture feature extraction method, and extracting second texture feature information from the second compressed feature using a texture feature extraction method; adjusting the parameters of the student network model based on the first and second texture feature information to obtain the target network model. This method effectively reduces the amount of data by compressing channels, improving performance without increasing the parameters of the network model.
[0109] Example 2
[0110] Based on the same inventive concept, embodiments of the present invention also provide an apparatus for obtaining a target network model based on shallow compressed features, such as... Figure 5 The above includes:
[0111] The acquisition module 501 is used to acquire the teacher network model, the student network model, and the training dataset, wherein the student network model is a simplified version of the teacher network model.
[0112] The first extraction module 502 is used to train the student network model based on the training dataset to extract a first shallow feature set, and to train the teacher network model to extract a second shallow feature set.
[0113] Compression module 503 is used to perform channel compression on the first shallow feature set to obtain a first compressed feature, and to perform channel compression on the second shallow feature set to obtain a second compressed feature;
[0114] The second extraction module 504 is used to extract first texture feature information from the first compressed feature using a texture feature extraction method, and to extract second texture feature information from the second compressed feature using the same method.
[0115] The module 505 is used to adjust the parameters of the student network model based on the first texture feature information and the second texture feature information to obtain the target network model.
[0116] In one optional implementation, the first extraction module 502 is configured to:
[0117] Based on the training dataset, the student network model is trained, and a first shallow feature set is extracted before the first downsampling of the student network model.
[0118] Based on the training dataset, the teacher network model is trained, and a second shallow feature set is extracted before the first downsampling of the teacher network model.
[0119] In one alternative implementation, the compression module 503 is used for:
[0120] Obtain the first standard deviation of each channel dimension in the first shallow feature set and the second standard deviation of each channel dimension in the second shallow feature set;
[0121] Based on the first standard deviation, determine the first weight of each channel in the first shallow feature set, and based on the second standard deviation, determine the second weight of each channel in the second shallow feature set.
[0122] Based on the first weight and the first shallow feature set, a first compressed feature is obtained from the student network model, and based on the second weight and the second shallow feature set, a second compressed feature is obtained from the teacher network model.
[0123] In one optional implementation, the second extraction module 504 is used for:
[0124] Based on the preset size local features of the first compression feature, a first GLBP kernel is determined, and based on the preset size local features of the second compression feature, a second GLBP kernel is determined.
[0125] Based on the first GLBP kernel, the first texture feature information extracted from the first compressed feature is obtained, and based on the second GLBP kernel, the second texture feature information extracted from the second compressed feature is obtained.
[0126] In one alternative implementation, module 505 is obtained, comprising:
[0127] A determining unit is used to determine the shallow texture loss based on the first texture feature and the second texture feature;
[0128] The obtained unit is used to adjust the parameters of the student network model based on the shallow texture loss to obtain the target network model.
[0129] In one alternative implementation, a unit is obtained for:
[0130] The total network loss is determined according to the following formula, based on the shallow texture loss, the cross loss entropy loss, and the distillation loss;
[0131] LTotal =αL CE +βL KD +γL SeKD
[0132] Among them, L Total L is the total loss of the network. CE For the crossover loss entropy loss, L KD For the distillation loss, L SeKD The shallow texture loss is represented by α, β, and γ, which are hyperparameters used to adjust the balance.
[0133] Based on the total network loss, the parameters of the student network model are adjusted to obtain the target network model.
[0134] Example 3
[0135] Based on the same inventive concept, embodiments of the present invention provide a computer device, such as... Figure 6 As shown, it includes a memory 604, a processor 602, and a computer program stored in the memory 604 and executable on the processor 602. When the processor 602 executes the program, it implements the steps of the above-described method for obtaining a target network model based on shallow compressed features.
[0136] Among them, Figure 6 In this document, a bus architecture (represented by bus 600) is used. Bus 600 may include any number of interconnected buses and bridges, linking various circuits including one or more processors represented by processor 602 and memory represented by memory 604. Bus 600 may also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. Bus interface 606 provides an interface between bus 600 and receiver 601 and transmitter 603. Receiver 601 and transmitter 603 may be the same element, i.e., a transceiver, providing a unit for communicating with various other devices over a transmission medium. Processor 602 is responsible for managing bus 600 and general processing, while memory 604 can be used to store data used by processor 602 during operation.
[0137] Example 4
[0138] Based on the same inventive concept, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described steps of obtaining a target network model based on shallow compression features.
[0139] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of the invention.
[0140] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0141] Similarly, it should be understood that, in order to simplify this disclosure and aid in understanding one or more of the various aspects of the invention, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, this method of disclosure should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into this detailed description, wherein each claim itself is a separate embodiment of the invention.
[0142] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0143] Furthermore, those skilled in the art will understand that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are intended to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
[0144] The various component embodiments of the present invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the apparatus or computer device for acquiring target network models based on shallow compression features according to embodiments of the present invention. The present invention can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such programs implementing the present invention can be stored on a computer-readable medium or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0145] It should be noted that the above embodiments are illustrative of the invention and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
Claims
1. A method for obtaining a target network model based on shallow compressed features, characterized in that, include: Obtain a teacher network model, a student network model, and a training dataset. The student network model is a simplified version of the teacher network model. The training dataset is a preprocessed dataset, including random horizontal flipping, random cropping to 32×32, and regularization. Based on the training dataset, the student network model is trained to extract a first shallow feature set, and the teacher network model is trained to extract a second shallow feature set. Channel compression is performed on the first shallow feature set to obtain a first compressed feature, and channel compression is performed on the second shallow feature set to obtain a second compressed feature; The first compressed feature is processed using a texture feature extraction method to extract first texture feature information, and the second compressed feature is processed using the same method to extract second texture feature information, including: Based on the preset size local features of the first compression feature, a first GLBP kernel is determined, and based on the preset size local features of the second compression feature, a second GLBP kernel is determined. Based on the first GLBP kernel, the first texture feature information extracted from the first compressed feature is obtained; based on the second GLBP kernel, the second texture feature information extracted from the second compressed feature is obtained. Based on the first texture feature information and the second texture feature information, the parameters of the student network model are adjusted to obtain the target network model, and the target network model is applied to the face recognition model.
2. The method as described in claim 1, characterized in that, The process of training the student network model based on the training dataset to extract a first shallow feature set, and training the teacher network model to extract a second shallow feature set, includes: Based on the training dataset, the student network model is trained, and a first shallow feature set is extracted before the first downsampling of the student network model. Based on the training dataset, the teacher network model is trained, and a second shallow feature set is extracted before the first downsampling of the teacher network model.
3. The method as described in claim 1, characterized in that, The step of performing channel compression on the first shallow feature set to obtain a first compressed feature, and performing channel compression on the second shallow feature set to obtain a second compressed feature, includes: Obtain the first standard deviation of each channel dimension in the first shallow feature set and the second standard deviation of each channel dimension in the second shallow feature set; Based on the first standard deviation, determine the first weight of each channel in the first shallow feature set, and based on the second standard deviation, determine the second weight of each channel in the second shallow feature set. Based on the first weight and the first shallow feature set, a first compressed feature is obtained from the student network model, and based on the second weight and the second shallow feature set, a second compressed feature is obtained from the teacher network model.
4. The method as described in claim 1, characterized in that, The step of adjusting the parameters of the student network model based on the first texture feature information and the second texture feature information to obtain the target network model includes: The shallow texture loss is determined based on the first texture feature and the second texture feature; Based on the shallow texture loss, the parameters of the student network model are adjusted to obtain the target network model.
5. The method as described in claim 4, characterized in that, The step of adjusting the parameters of the student network model based on the shallow texture loss to obtain the target network model includes: Obtain the cross-loss entropy loss between the final output of the student network model and the real target, and the distillation loss between the final output of the student network model and the final output of the teacher network model; Based on the shallow texture loss, the cross loss entropy loss, and the distillation loss, the parameters of the student network model are adjusted to obtain the target network model.
6. The method as described in claim 5, characterized in that, The process of adjusting the parameters of the student network model based on the shallow texture loss, the cross-loss entropy loss, and the distillation loss to obtain the target network model includes: The total network loss is determined according to the following formula, based on the shallow texture loss, the cross loss entropy loss, and the distillation loss; ; in, The total network loss is... The crossover loss is the entropy loss. For the distillation loss, This is the shallow texture loss. These are hyperparameters used to adjust the balance; Based on the total network loss, the parameters of the student network model are adjusted to obtain the target network model.
7. A device for obtaining a target network model based on shallow compressed features, characterized in that, include: The acquisition module is used to acquire the teacher network model, the student network model, and the training dataset. The student network model is a simplified version of the teacher network model. The training dataset is a preprocessed dataset, including random horizontal flipping, random cropping to 32×32, and regularization, to obtain the training dataset. The first extraction module is used to train the student network model based on the training dataset to extract a first shallow feature set, and to train the teacher network model to extract a second shallow feature set. A compression module is used to perform channel compression on the first shallow feature set to obtain a first compressed feature, and to perform channel compression on the second shallow feature set to obtain a second compressed feature; The second extraction module is used to extract first texture feature information from the first compressed feature using a texture feature extraction method, and to extract second texture feature information from the second compressed feature using the same method. The second extraction module is used for: Based on the preset size local features of the first compression feature, a first GLBP kernel is determined, and based on the preset size local features of the second compression feature, a second GLBP kernel is determined. Based on the first GLBP kernel, the first texture feature information extracted from the first compressed feature is obtained; based on the second GLBP kernel, the second texture feature information extracted from the second compressed feature is obtained. The module is used to adjust the parameters of the student network model based on the first texture feature information and the second texture feature information to obtain the target network model, and then apply the target network model to the face recognition model.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Focus area depth omics feature extraction method and device based on knowledge distillation
CN114723746A
Counterfeit image detection method and device based on attention mechanism and knowledge distillation
CN115471736A