CN109858613B - Compression method and system of deep neural network and terminal equipment - Google Patents

Compression method and system of deep neural network and terminal equipment Download PDF

Info

Publication number
CN109858613B
CN109858613B CN201910059183.7A CN201910059183A CN109858613B CN 109858613 B CN109858613 B CN 109858613B CN 201910059183 A CN201910059183 A CN 201910059183A CN 109858613 B CN109858613 B CN 109858613B
Authority
CN
China
Prior art keywords
layer
filter
feature map
characteristic diagram
pruning
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.)
Active
Application number
CN201910059183.7A
Other languages
Chinese (zh)
Other versions
CN109858613A (en
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.)
Peng Cheng Laboratory
Original Assignee
Peng Cheng Laboratory
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 Peng Cheng Laboratory filed Critical Peng Cheng Laboratory
Priority to CN201910059183.7A priority Critical patent/CN109858613B/en
Publication of CN109858613A publication Critical patent/CN109858613A/en
Application granted granted Critical
Publication of CN109858613B publication Critical patent/CN109858613B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Analysis (AREA)

Abstract

The invention is suitable for the technical field of computers, and provides a compression method, a compression system and a compression terminal device of a deep neural network, wherein the compression method comprises the following steps: inputting test sample data, acquiring an original feature map of an L-th layer of the deep neural network, and determining a redundant filter of the L-th layer according to the original feature map of the L-th layer; pruning the L-th layer according to the redundant filter; acquiring an original characteristic diagram of the L +1 th layer and a characteristic diagram of the L +1 th layer after pruning; inputting the original characteristic diagram of the L +1 th layer and the pruned characteristic diagram of the L +1 th layer into a filter learning model, automatically learning through the filter learning model and outputting a reconstruction filter of the L +1 th layer; inputting the feature map after pruning of the L-th layer into a reconstruction filter of the L + 1-th layer to obtain a target feature map of the L + 1-th layer, pruning and reconstructing based on the feature map, automatically learning and reconstructing the filter by combining the influence of pruning, ensuring the classification accuracy of the compressed deep neural network model while realizing the structural sparsity of the filter, and improving the calculation efficiency.

Description

Compression method and system of deep neural network and terminal equipment
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a compression method and system of a deep neural network and terminal equipment.
Background
Deep Neural networks (CNNs) have enjoyed significant success in computer vision tasks such as classification, detection, and segmentation through large-scale web learning that utilizes large amounts of data. However, deep neural networks typically occupy significant computing resources and memory space, making their deployment on resource-constrained devices, such as mobile and embedded, difficult. In order to reduce the calculation and storage cost, many researches work on compressing the deep neural network model from the storage and speed-up perspectives, wherein the compression method comprises pruning, low-rank decomposition, parameter quantification, transformation/compression convolution kernel, compact network structure design and the like.
Pruning is an effective deep neural network compression technology and mainly comprises parameter pruning and feature map channel pruning. The parameter pruning mainly acts on a full connection layer to reduce storage, the storage of a network model is reduced by reducing network connection, the feature diagram pruning mainly acts on a convolutional layer to accelerate, and redundant channels of the feature diagram are deleted. However, the parameter pruning method usually introduces unstructured sparse connection, and reduces the computation efficiency of the deep neural network. The feature map pruning method usually ignores the bias of the feature map, so that unimportant filters cannot be accurately judged, and the classification accuracy of the compressed deep neural network model is not high.
In summary, the existing method for pruning and compressing the deep neural network has the problems of low calculation efficiency and low classification accuracy.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, a system, and a terminal device for compressing a deep neural network, so as to solve the problems of low computational efficiency and low classification accuracy of the current method for performing pruning compression processing on the deep neural network.
The first aspect of the present invention provides a compression method for a deep neural network, including:
inputting test sample data, acquiring an original feature map of an L-th layer of the deep neural network, and determining a redundant filter of the L-th layer according to the original feature map of the L-th layer; wherein L is a positive integer not less than 1;
pruning the L-th layer according to the redundant filter;
acquiring an original characteristic diagram of the L +1 th layer and a characteristic diagram of the L +1 th layer after pruning;
inputting the original feature map of the L +1 th layer and the feature map after pruning of the L +1 th layer into a filter learning model, automatically learning through the filter learning model and outputting the reconstructed filter of the L +1 th layer;
and inputting the feature map after the L-th layer pruning into the reconstruction filter of the L + 1-th layer to obtain the target feature map of the L + 1-th layer.
A second aspect of the present invention provides a deep neural network compression system, comprising:
the redundancy determining module is used for inputting test sample data, acquiring an original feature map of the L-th layer of the deep neural network, and determining a redundancy filter of the L-th layer according to the original feature map of the L-th layer; wherein L is a positive integer not less than 1;
the pruning module is used for pruning the L-th layer according to the redundant filter;
the acquisition module is used for acquiring the original characteristic diagram of the L +1 th layer and the characteristic diagram of the L +1 th layer after pruning;
the reconstruction module is used for inputting the original feature map of the L +1 th layer and the feature map after the L +1 th layer is pruned into a filter learning model, automatically learning through the filter learning model and outputting the reconstruction filter of the L +1 th layer;
and the generating module is used for inputting the feature map subjected to the pruning of the L-th layer into the reconstruction filter of the L + 1-th layer so as to generate the target feature map of the L + 1-th layer.
A third aspect of the present invention provides a terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
inputting test sample data, acquiring an original feature map of an L-th layer of the deep neural network, and determining a redundant filter of the L-th layer according to the original feature map of the L-th layer; wherein L is a positive integer not less than 1;
pruning the L-th layer according to the redundant filter;
acquiring an original characteristic diagram of the L +1 th layer and a characteristic diagram of the L +1 th layer after pruning;
inputting the original feature map of the L +1 th layer and the feature map after pruning of the L +1 th layer into a filter learning model, automatically learning through the filter learning model and outputting the reconstructed filter of the L +1 th layer;
and inputting the feature map after the L-th layer pruning into the reconstruction filter of the L + 1-th layer to obtain the target feature map of the L + 1-th layer.
A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program which, when executed by a processor, performs the steps of:
inputting test sample data, acquiring an original feature map of an L-th layer of the deep neural network, and determining a redundant filter of the L-th layer according to the original feature map of the L-th layer; wherein L is a positive integer not less than 1;
pruning the L-th layer according to the redundant filter;
acquiring an original characteristic diagram of the L +1 th layer and a characteristic diagram of the L +1 th layer after pruning;
inputting the original feature map of the L +1 th layer and the feature map after pruning of the L +1 th layer into a filter learning model, automatically learning through the filter learning model and outputting the reconstructed filter of the L +1 th layer;
and inputting the feature map after the L-th layer pruning into the reconstruction filter of the L + 1-th layer to obtain the target feature map of the L + 1-th layer.
According to the compression method, the compression system and the terminal device of the deep neural network, pruning and reconstruction are carried out on the basis of the feature map of the deep neural network, the structural sparsity of the filter is realized through the feature map reconstruction method based on the norm, the filter is automatically learned and reconstructed by combining the influence of pruning, the classification accuracy of the compressed deep neural network model can be guaranteed while the structural sparsity of the filter is realized, and the calculation efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic flow chart illustrating an implementation of a compression method for a deep neural network according to an embodiment of the present invention;
FIG. 2 is a schematic diagram illustrating pruning and reconstruction steps in the deep neural network compression method according to one embodiment;
fig. 3 is a schematic flow chart of an implementation of step S101 according to a second embodiment of the present invention;
fig. 4 is a schematic flow chart of an implementation of step S102 according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of a deep neural network compression system according to a fourth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a redundancy determining module 101 according to a fifth embodiment of the present invention;
fig. 7 is a schematic structural diagram of the pruning module 102 in a fourth embodiment according to a sixth embodiment of the present invention;
fig. 8 is a schematic diagram of a terminal device according to a seventh embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
The first embodiment is as follows:
as shown in fig. 1, this embodiment provides a compression method for a deep neural network, which is mainly applied to computer devices such as audio and video processing devices and face recognition devices for classifying, detecting and segmenting audio, video and images, where the devices may be general terminal devices, mobile terminal devices, embedded terminal devices, or non-embedded terminal devices, and are not limited herein. The compression method of the deep neural network specifically comprises the following steps:
step S101: inputting test sample data, acquiring an original feature map of an L-th layer of the deep neural network, and determining a redundant filter of the L-th layer according to the original feature map of the L-th layer; wherein L is a positive integer not less than 1.
The test sample data is set for testing the classification accuracy of the compressed deep neural network and the deep neural network before compression, and a stable deep neural network model is obtained after compression by using a large amount of test sample data as input parameters in the process of compressing the deep neural network.
It should be further noted that, for the deep neural network, it is mainly a convolutional neural network, and the dimension of the convolutional kernel of the L-th layer is [ k, k, c ]L,nL]Wherein n isLRepresenting the number of filters, cLThe number of channels is shown, k represents the height and width of the convolution kernel, and in this embodiment, the height and width of the filter used in all layers are set to be the same, i.e., k × k. The output dimension of the characteristic diagram corresponding to the L-th layer is hL,wL,cL]. Wherein h isLHeight, w, of the characteristic diagramLThe width of the feature map is shown.
In specific application, test sample data is input into a deep neural network, a feature map of an L-th layer is reconstructed, so that a redundant filter of the L-th layer is obtained, specifically, the test sample data is input into the deep neural network to be compressed, an original feature map of the L-th layer can be obtained after the test sample data passes through the L-th layer of the deep neural network, and then the redundant filter of the L-th layer can be determined by reconstructing according to the original feature map of the L-th layer. Illustratively, the test sample data is 5000 test sample images, that is, 5000 test sample images are input into the deep neural network, and after passing through n filters of the L-th layer, the original feature map output of the L-th layer is obtained, where the original feature map output includes 5000 cubes, and each cube has a size h × w × c.
In specific application, the original characteristic diagram of the L-th layer is reconstructed through a reconstruction model which has the function of performing robust reconstruction on the characteristic diagram of the current layer and the function of judging the redundant state of the filter of the current layer under the robust reconstruction.
Step S102: and pruning the L-th layer according to the redundant filter.
It should be noted that: the pruning of the L-th layer according to the redundant filter means removing the redundant filter from the L-th layer filter and simultaneously removing the characteristic diagram of the channel corresponding to the redundant filter.
Step S103: and acquiring the original characteristic diagram of the L +1 th layer and the characteristic diagram of the L +1 th layer after pruning.
In specific application, the output of the L-th layer is used as the input parameter of the L + 1-th layer and is input into the L + 1-th layer to obtain an original characteristic diagram of the L + 1-th layer, and the characteristic diagram obtained by removing the characteristic diagram of the channel corresponding to the L-th layer redundant filter from the original characteristic diagram of the L-th layer is used as the characteristic diagram after L-th layer pruning.
Step S104: and inputting the original feature map of the L +1 th layer and the feature map after pruning of the L +1 th layer into a filter learning model, and automatically learning and outputting the reconstruction filter of the L +1 th layer through the filter learning model.
Fig. 2 shows a schematic diagram of the pruning and reconstructing steps of the deep neural network provided in this embodiment, in a specific application, pruning the L-th layer may cause the filters and channels of the L + 1-th layer to be relatively reduced, which may cause a relatively large error in the feature map output by the L + 1-th layer, and if only the redundancy of the L-th layer is removed, the performance loss of the compressed deep neural network may not be guaranteed, which may cause the classification accuracy of the compressed deep neural network to be reduced. Therefore, in order to ensure that the removed redundant filter and the redundant channel of the feature map do not affect the feature map of the L +1 th layer, as shown in fig. 2, the feature map after pruning of the L th layer and the original feature map of the L +1 th layer are input into the filter learning model as input parameters of the filter learning model to obtain the reconstruction filter of the L +1 th layer. The filter learning model is an automatic learning model constructed by reconstructing according to the L-th layer pruned feature map and the L + 1-th layer original feature map, so that the reconstruction filter can be automatically output, and the L + 1-th layer target feature map generated by the L + 1-th layer reconstruction filter can effectively eliminate the influence caused by removing the L-th layer filter and removing the corresponding channel of the L-th layer feature map.
In a specific application, the objective function of the filter learning model is as follows:
Figure BDA0001953565680000071
wherein, YL+1The original characteristic diagram of the L +1 th layer is obtained, X 'is the characteristic diagram of the L +1 th layer after the redundant filter is removed, and W' is the reconstruction filter of the L +1 th layer.
Step S105: and inputting the feature map after the L-th layer pruning into the reconstruction filter of the L + 1-th layer to obtain the target feature map of the L + 1-th layer.
In a specific application, the feature map after the pruning of the L-th layer is used as an input parameter, and the input parameter is input into a reconstruction filter of the L + 1-th layer, so that the target feature map of the L + 1-th layer can be obtained.
In this embodiment, the above steps S101 to S105 are continuously repeated from the first layer of the deep neural network to the last layer of the deep neural network, and all the redundant filters and redundant channels of the entire deep neural network are removed, thereby completing the compression process of the deep neural network.
It should be noted that the original calculation amount of the lth layer before the compression of the deep neural network is k × cL*nL*hL*wLThe original calculation amount of the L +1 th layer is k x nL*nL+1*hL+*wL+1. If the number of redundant filters removed in the L-th layer is 2, the original calculation amount is correspondingly reduced by 2 x k x cL*hL*wLThe calculation of the L +1 th layer is reduced by 2 k nL*hL+*wL+1
According to the compression method of the deep neural network, pruning and reconstruction are performed through the feature map based on the deep neural network, the structural sparsity of the filter is realized through the feature map reconstruction method based on the norm, the filter is automatically learned and reconstructed by combining the influence of pruning, the classification accuracy of the compressed deep neural network model can be guaranteed while the structural sparsity of the filter is realized, and the calculation efficiency is improved.
Example two:
as shown in fig. 3, in the present embodiment, the step S101 in the first embodiment specifically includes:
step S201: and inputting test sample data into the deep neural network, and processing the test sample data through the filter of the L-th layer.
Step S202: and acquiring output results of the filters.
Step S203: and overlapping and transposing the output results of the filters to obtain the original characteristic diagram of the L-th layer.
In specific application, test sample data is input into a deep neural network, data processing is performed through an L-th filter, output results of the filters are correspondingly output, and the original feature map of the L-th layer can be obtained after the output results are overlapped and transposed. Illustratively, the test sample data is 5000 test sample images, that is, 5000 test sample images are input into the deep neural network, and after n filters of the L-th layer, the original feature map output of the L-th layer is obtained, wherein the original feature map output comprises 5000 cubes, and the size of each cube is h × w × c. And in order to simplify the calculation, 10 objects (responses) are randomly selected from each feature map cube to represent 5000 x h w of data information, and the original feature map of the L layer is obtained after the 10 objects are rotated.
Step S204: and reconstructing the characteristic diagram of the L-th layer according to the original characteristic diagram of the L-th layer, and determining the redundant filter of the L-th layer.
In a specific application, the feature map of the L-th layer is reconstructed by a reconstruction objective function, where the reconstruction objective function specifically is:
Figure BDA0001953565680000081
wherein, YLThe original characteristic diagram of the L-th layer is shown, L is the column vector of the test sample data, muLIs a bias vector of the deep neural network model, ALAnd lambda is a regular parameter, and is a column consistency parameter of the L-th layer.
In a specific application, the reconstruction objective function is an objective function of a robust reconstruction model, and the offset vector mu of the deep neural network modelLThe method is obtained by automatic learning, and can carry out adaptive adjustment according to the redundancy state of the current layer so as to eliminate the average error of the accumulated characteristic diagram. The robust reconstruction model constrains the column consistency of the L-th layer by L2,1 norm, ALSize of cL*cL,,ALAnd presenting column consistency to represent the redundant state of the filter in the L-th layer, screening out the filter with redundancy higher than a threshold value through the column consistency, and identifying the filter as a redundant filter.
It should be noted that the parameter assignment of λ needs to be considered by integrating the classification accuracy and the calculation performance of the deep neural network, and when λ is larger, aLThe column consistency in the deep neural network is sparse and obvious, namely, the number of deleted channels is large, the classification accuracy of the deep neural network is obviously reduced if necessary channels are deleted, and when lambda is small, ALThe column consistency in (1) is not obvious, namely, the number of the deleted channels is less, so that the calculation amount is larger. It should be further noted that the parameter assignment of λ obtains a reasonable parameter as a regular parameter of the robust reconstruction model after performing parameter adjustment according to the test sample data, and the adjustment process is not described herein again.
Example three:
as shown in fig. 4, in the present embodiment, the step S102 in the first embodiment specifically includes:
step S301: and searching a corresponding channel of the redundant filter according to the redundant filter.
In a specific application, since the corresponding channel of the redundant filter in the feature map corresponds to the redundant filter, the corresponding redundant channel can be found by the redundant filter.
Step S302: cropping the redundant filter from the filter of the L-th layer.
Step S303: and cutting out the corresponding channel of the redundant filter from the original characteristic diagram of the L-th layer to obtain the characteristic diagram of the L-th layer after pruning.
In specific application, the redundant filter is cut from the filter of the L-th layer, the channel corresponding to the redundant filter is cut from the original characteristic diagram of the L-th layer, the pruning process is completed, and the filter of the L-th layer after pruning and the characteristic diagram of the L-th layer after pruning are obtained.
Example four:
as shown in fig. 5, the present embodiment provides a deep neural network compression system 100 for performing the method steps in the first embodiment, which includes a redundancy determining module 101, a pruning module 102, an obtaining module 103, a reconstructing module 104, and a generating module 105.
The redundancy determining module 101 is configured to input test sample data, obtain an original feature map of an L-th layer of the deep neural network, and determine a redundancy filter of the L-th layer according to the original feature map of the L-th layer; wherein L is a positive integer not less than 1.
The pruning module 102 is configured to prune the lth layer according to the redundant filter.
The obtaining module 103 is configured to obtain an original feature map of the L +1 th layer and the feature map after pruning of the L th layer.
The reconstruction module 104 is configured to input the original feature map of the L +1 th layer and the feature map after pruning of the L +1 th layer into a filter learning model, automatically learn through the filter learning model, and output the reconstruction filter of the L +1 th layer.
The generating module 105 is configured to input the feature map after the L-th layer pruning into the reconstruction filter of the L + 1-th layer to generate the target feature map of the L + 1-th layer.
It should be noted that the modules may be functional modules in computer equipment, such as audio and video processing equipment, face recognition equipment, and the like, which are used for classifying, detecting, and segmenting audio, video, and images, and the equipment may be general terminal equipment, or mobile terminal equipment, or embedded terminal equipment, or non-embedded terminal equipment, which is not limited herein.
It should be noted that, since the deep neural network compression system provided in the embodiment of the present invention is based on the same concept as the method embodiment shown in fig. 1 of the present invention, the technical effect brought by the deep neural network compression system is the same as the method embodiment shown in fig. 1 of the present invention, and specific contents may refer to the description in the method embodiment shown in fig. 1 of the present invention, and are not described herein again.
Therefore, the deep neural network compression system provided by this embodiment can also perform pruning and reconstruction through the feature map based on the deep neural network, realize structured sparseness of the filter through the feature map reconstruction method based on the norm, automatically learn and reconstruct the filter in combination with the influence of pruning, and while realizing structured sparseness of the filter, can ensure classification accuracy of the compressed deep neural network model, and improve calculation efficiency.
Example five:
as shown in fig. 6, in the present embodiment, the redundancy determining module 101 in the fourth embodiment includes a structure for executing the method steps in the embodiment corresponding to fig. 3, and includes an input unit 201, an output unit 202, a superimposing unit 203, and a determining unit 204.
The input unit 201 is configured to input test sample data into the deep neural network, and perform processing through the filter of the L-th layer.
The output unit 202 is used for obtaining output results of the respective filters.
The superimposing unit 203 is configured to superimpose and transpose the output results of the filters to obtain the original feature map of the L-th layer.
The determining unit 204 is configured to reconstruct the feature map of the L-th layer according to the original feature map of the L-th layer, and determine a redundant filter of the L-th layer.
Example six:
as shown in fig. 7, in the present embodiment, the pruning module 102 in the fourth embodiment includes a structure for executing the method steps in the embodiment corresponding to fig. 4, and includes a channel searching unit 301, a filter clipping unit 302, and a channel clipping unit 303.
The channel searching unit 301 is configured to search a corresponding channel of the redundant filter according to the redundant filter.
The filter clipping unit 302 is configured to clip the redundant filter from the filter of the L-th layer.
The channel cutting unit 303 is configured to cut out a corresponding channel of the redundant filter from the original feature map of the L-th layer to obtain a feature map of the L-th layer after pruning.
Example seven:
fig. 8 is a schematic diagram of a terminal device according to a seventh embodiment of the present invention. As shown in fig. 8, the terminal device 8 of this embodiment includes: a processor 80, a memory 81 and a computer program 82, e.g. a program, stored in said memory 81 and executable on said processor 80. The processor 80, when executing the computer program 82, implements the steps in the various method embodiments described above, such as the steps S101 to S105 shown in fig. 1. Alternatively, the processor 80, when executing the computer program 82, implements the functions of the modules/units in the system embodiments described above, such as the functions of the modules 101 to 105 shown in fig. 5.
Illustratively, the computer program 82 may be partitioned into one or more modules/units that are stored in the memory 81 and executed by the processor 80 to implement the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 82 in the terminal device 8. For example, the computer program 82 may be divided into a redundancy determination module, a pruning module, an acquisition module, a reconstruction module, and a generation module, each of which functions as follows:
the redundancy determining module is used for inputting test sample data, acquiring an original feature map of the L-th layer of the deep neural network, and determining a redundancy filter of the L-th layer according to the original feature map of the L-th layer; wherein L is a positive integer not less than 1;
the pruning module is used for pruning the L-th layer according to the redundant filter;
the acquisition module is used for acquiring the original characteristic diagram of the L +1 th layer and the characteristic diagram of the L +1 th layer after pruning;
the reconstruction module is used for inputting the original feature map of the L +1 th layer and the feature map after the L +1 th layer is pruned into a filter learning model, automatically learning through the filter learning model and outputting the reconstruction filter of the L +1 th layer;
and the generating module is used for inputting the feature map subjected to the pruning of the L-th layer into the reconstruction filter of the L + 1-th layer so as to generate the target feature map of the L + 1-th layer.
The terminal device 8 may be a desktop computer, a notebook, a palm computer, a cloud management server, or other computing devices. The terminal device may include, but is not limited to, a processor 80, a memory 81. Those skilled in the art will appreciate that fig. 8 is merely an example of a terminal device 8 and does not constitute a limitation of terminal device 8 and may include more or fewer components than shown, or some components may be combined, or different components, e.g., the terminal device may also include input-output devices, network access devices, buses, etc.
The Processor 80 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 81 may be an internal storage unit of the terminal device 8, such as a hard disk or a memory of the terminal device 8. The memory 81 may also be an external storage device of the terminal device 8, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 8. Further, the memory 81 may also include both an internal storage unit and an external storage device of the terminal device 8. The memory 81 is used for storing the computer program and other programs and data required by the terminal device. The memory 81 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the system is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the wireless terminal may refer to the corresponding process in the foregoing method embodiments, and details are not repeated here.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed system/terminal device and method can be implemented in other ways. For example, the above-described system/terminal device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, systems or units, and may be in an electrical, mechanical or other form.
The 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 a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention 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 modules/units, if implemented in the form of software functional units and configured for individual product sale or use, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or system capable of carrying said computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, etc. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media which may not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (8)

1. A method for compressing a deep neural network, comprising:
inputting test sample data, acquiring an original feature map of an L-th layer of the deep neural network, and determining a redundant filter of the L-th layer according to the original feature map of the L-th layer; wherein L is a positive integer not less than 1;
pruning the L-th layer according to the redundant filter;
acquiring an original characteristic diagram of the L +1 th layer and a characteristic diagram of the L +1 th layer after pruning;
inputting the original feature map of the L +1 th layer and the feature map after pruning of the L +1 th layer into a filter learning model, automatically learning through the filter learning model and outputting the reconstructed filter of the L +1 th layer;
inputting the feature map after the L-th layer pruning into the reconstruction filter of the L + 1-th layer to obtain a target feature map of the L + 1-th layer;
the inputting test sample data, obtaining an original feature map of an L-th layer of the deep neural network, and determining a redundancy filter of the L-th layer according to the original feature map of the L-th layer includes:
inputting test sample data into a deep neural network, and processing the test sample data through the filter of the L-th layer;
obtaining output results of each filter;
superposing and transposing the output results of the filters to obtain an original characteristic diagram of the L-th layer;
and reconstructing the characteristic diagram of the L-th layer according to the original characteristic diagram of the L-th layer, and determining the redundant filter of the L-th layer.
2. The method according to claim 1, wherein the reconstructing the characteristic map of the L-th layer according to the original characteristic map of the L-th layer and determining the redundant filter of the L-th layer comprises:
reconstructing the characteristic diagram of the L-th layer by a reconstruction objective function, wherein the reconstruction objective function specifically comprises:
Figure FDA0002786130280000021
wherein, YLThe original characteristic diagram of the L-th layer is shown, L is the column vector of the test sample data, muLIs the deep nerveOffset vector of network model, ALAnd lambda is a regular parameter, and is a column consistency parameter of the L-th layer.
3. The method of claim 1, wherein pruning the L < th > layer according to the redundancy filter comprises:
searching a corresponding channel of the redundant filter according to the redundant filter;
cropping the redundant filter from the filter of the L-th layer;
and cutting out the corresponding channel of the redundant filter from the original characteristic diagram of the L-th layer to obtain the characteristic diagram of the L-th layer after pruning.
4. The method of claim 1, wherein the objective function of the filter learning model is:
Figure FDA0002786130280000022
wherein, YL+1The original characteristic diagram of the L +1 th layer is obtained, X 'is the characteristic diagram of the L +1 th layer after the redundant filter is removed, and W' is the reconstruction filter of the L +1 th layer.
5. A deep neural network compression system, comprising:
the redundancy determining module is used for inputting test sample data, acquiring an original feature map of the L-th layer of the deep neural network, and determining a redundancy filter of the L-th layer according to the original feature map of the L-th layer; wherein L is a positive integer not less than 1;
the pruning module is used for pruning the L-th layer according to the redundant filter;
the acquisition module is used for acquiring the original characteristic diagram of the L +1 th layer and the characteristic diagram of the L +1 th layer after pruning;
the reconstruction module is used for inputting the original feature map of the L +1 th layer and the feature map after the L +1 th layer is pruned into a filter learning model, automatically learning through the filter learning model and outputting the reconstruction filter of the L +1 th layer;
a generating module, configured to input the feature map after the L-th layer pruning into the reconstruction filter of the L + 1-th layer to generate a target feature map of the L + 1-th layer;
wherein the redundancy determination module comprises:
the input unit is used for inputting test sample data into the deep neural network and processing the test sample data through the filter of the L-th layer;
the output unit is used for acquiring the output result of each filter;
the superposition unit is used for superposing and transposing the output results of the filters to obtain the original characteristic diagram of the L-th layer;
and the determining unit is used for reconstructing the characteristic diagram of the L layer according to the original characteristic diagram of the L layer and determining the redundant filter of the L layer.
6. The deep neural network compression system of claim 5, wherein the pruning module comprises:
the channel searching unit is used for searching a corresponding channel of the redundant filter according to the redundant filter;
a filter clipping unit for clipping the redundant filter from the filter of the L-th layer;
and the channel cutting unit is used for cutting the corresponding channel of the redundant filter from the original characteristic diagram of the L-th layer to obtain the L-th layer cut characteristic diagram.
7. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 4 when executing the computer program.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.
CN201910059183.7A 2019-01-22 2019-01-22 Compression method and system of deep neural network and terminal equipment Active CN109858613B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910059183.7A CN109858613B (en) 2019-01-22 2019-01-22 Compression method and system of deep neural network and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910059183.7A CN109858613B (en) 2019-01-22 2019-01-22 Compression method and system of deep neural network and terminal equipment

Publications (2)

Publication Number Publication Date
CN109858613A CN109858613A (en) 2019-06-07
CN109858613B true CN109858613B (en) 2021-02-19

Family

ID=66895633

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910059183.7A Active CN109858613B (en) 2019-01-22 2019-01-22 Compression method and system of deep neural network and terminal equipment

Country Status (1)

Country Link
CN (1) CN109858613B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110969240B (en) * 2019-11-14 2022-12-09 北京达佳互联信息技术有限公司 Pruning method, device, equipment and medium for deep convolutional neural network
CN110929805B (en) * 2019-12-05 2023-11-10 上海肇观电子科技有限公司 Training method, target detection method and device for neural network, circuit and medium
CN111488986B (en) * 2020-04-13 2023-06-27 商汤集团有限公司 Model compression method, image processing method and device
CN113077016A (en) * 2021-05-06 2021-07-06 中国工商银行股份有限公司 Redundant feature detection method, detection device, electronic apparatus, and medium
CN113657592B (en) * 2021-07-29 2024-03-05 中国科学院软件研究所 Software-defined satellite self-adaptive pruning model compression method
CN114154626B (en) * 2021-12-14 2022-08-16 中国人民解放军国防科技大学 Filter pruning method for image classification task
CN114114564B (en) * 2022-01-26 2022-04-01 鹏城实验室 Space light-optical fiber coupling device and method based on visual detection
CN114997376A (en) * 2022-06-29 2022-09-02 中国电信股份有限公司 Model processing method, device and computer readable storage medium
CN117829241B (en) * 2024-03-04 2024-06-07 西北工业大学 Pruning method of convolutional neural network

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106875373A (en) * 2016-12-14 2017-06-20 浙江大学 Mobile phone screen MURA defect inspection methods based on convolutional neural networks pruning algorithms
CN107463965A (en) * 2017-08-16 2017-12-12 湖州易有科技有限公司 Fabric attribute picture collection and recognition methods and identifying system based on deep learning
CN108304928A (en) * 2018-01-26 2018-07-20 西安理工大学 Compression method based on the deep neural network for improving cluster
CN108629736A (en) * 2017-03-15 2018-10-09 三星电子株式会社 System and method for designing super-resolution depth convolutional neural networks
CN108846445A (en) * 2018-06-26 2018-11-20 清华大学 A kind of convolutional neural networks filter technology of prunning branches based on similarity-based learning

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109063835B (en) * 2018-07-11 2021-07-09 中国科学技术大学 Neural network compression device and method
CN109063834B (en) * 2018-07-12 2021-07-20 浙江工业大学 Neural network pruning method based on convolution characteristic response graph

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106875373A (en) * 2016-12-14 2017-06-20 浙江大学 Mobile phone screen MURA defect inspection methods based on convolutional neural networks pruning algorithms
CN108629736A (en) * 2017-03-15 2018-10-09 三星电子株式会社 System and method for designing super-resolution depth convolutional neural networks
CN107463965A (en) * 2017-08-16 2017-12-12 湖州易有科技有限公司 Fabric attribute picture collection and recognition methods and identifying system based on deep learning
CN108304928A (en) * 2018-01-26 2018-07-20 西安理工大学 Compression method based on the deep neural network for improving cluster
CN108846445A (en) * 2018-06-26 2018-11-20 清华大学 A kind of convolutional neural networks filter technology of prunning branches based on similarity-based learning

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
A novel channel pruning method for deep neural network compression;Yiming Hu 等;《arXiv:1805.11394v1 [cs.CV]》;20180529;第1-10页 *
ThiNet: A Filter Level Pruning Method for Deep Neural Network Compression;Jian-Hao Luo;《arXiv:1707.06342v1 [cs.CV]》;20170720;第1-10页 *
基于子像素全卷积的自编码网络结构优化;杨火祥 等;《深圳信息职业技术学院学报》;20180630;第78-84页 *
深度神经网络压缩与加速综述;纪荣嵘 等;《计算机研究与发展》;20181231;第1871-1888页 *

Also Published As

Publication number Publication date
CN109858613A (en) 2019-06-07

Similar Documents

Publication Publication Date Title
CN109858613B (en) Compression method and system of deep neural network and terminal equipment
CN109522874B (en) Human body action recognition method and device, terminal equipment and storage medium
US20180182377A1 (en) Method and device for extracting speech feature based on artificial intelligence
CN111553215A (en) Personnel association method and device, and graph convolution network training method and device
CN110782406B (en) Image denoising method and device based on information distillation network
CN112132279A (en) Convolutional neural network model compression method, device, equipment and storage medium
CN114429208A (en) Model compression method, device, equipment and medium based on residual structure pruning
CN112488297A (en) Neural network pruning method, model generation method and device
CN110135428A (en) Image segmentation processing method and device
CN111967478B (en) Feature map reconstruction method, system, storage medium and terminal based on weight overturn
CN114494006A (en) Training method and device for image reconstruction model, electronic equipment and storage medium
CN116009889A (en) Deep learning model deployment method and device, electronic equipment and storage medium
CN113627416B (en) Synchronous processing method, system, storage medium and terminal for picture classification and object detection
CN112580772B (en) Compression method and device for convolutional neural network
CN113139617A (en) Power transmission line autonomous positioning method and device and terminal equipment
CN114881913A (en) Image defect detection method and device, electronic equipment and storage medium
CN113408718B (en) Device processor selection method, system, terminal device and storage medium
CN117440104B (en) Data compression reconstruction method based on target significance characteristics
CN117113010B (en) Power transmission channel safety monitoring method and system based on convolutional network lightweight
CN113869225A (en) Face detection method and device and electronic equipment
CN115762532A (en) Voiceprint recognition method and device, computer equipment and storage medium
CN118470032A (en) Training method and device for super-resolution image segmentation model
CN115880514A (en) Power transmission and transformation equipment fault detection method and device, terminal and storage medium
CN115937528A (en) Feature processing method, feature extraction method, device and electronic equipment
CN116645269A (en) Method and device for light-weight image super-resolution and terminal equipment

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
GR01 Patent grant
GR01 Patent grant