CN109800869A - Data compression method and relevant apparatus - Google Patents

Data compression method and relevant apparatus Download PDF

Info

Publication number
CN109800869A
CN109800869A CN201811641325.2A CN201811641325A CN109800869A CN 109800869 A CN109800869 A CN 109800869A CN 201811641325 A CN201811641325 A CN 201811641325A CN 109800869 A CN109800869 A CN 109800869A
Authority
CN
China
Prior art keywords
data
packet
packets
matrix
data packets
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.)
Granted
Application number
CN201811641325.2A
Other languages
Chinese (zh)
Other versions
CN109800869B (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.)
Shenzhen Intellifusion Technologies Co Ltd
Original Assignee
Shenzhen Intellifusion Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Intellifusion Technologies Co Ltd filed Critical Shenzhen Intellifusion Technologies Co Ltd
Priority to CN201811641325.2A priority Critical patent/CN109800869B/en
Publication of CN109800869A publication Critical patent/CN109800869A/en
Priority to PCT/CN2019/114731 priority patent/WO2020134550A1/en
Application granted granted Critical
Publication of CN109800869B publication Critical patent/CN109800869B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Neurology (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The embodiment of the present application discloses a kind of data compression method and relevant apparatus, method is applied to the neural network model including N layers of structure, N is the integer greater than 1, method includes: to obtain the output data set of i-th layer of structure in neural network model, output data set includes the matrix of at least one m × n, m and n is the integer greater than 1, and i is 1 any one into N;Packet segmentation is carried out to the matrix of at least one m × n, the M after being divided first data packet, M is the integer more than or equal to 1;Data compression is carried out to M the first data packets, two the second data packets after obtaining data compression.The compression efficiency of the data in neural network model can be improved using the embodiment of the present application.

Description

Data compression method and relevant apparatus
Technical field
This application involves nerual network technique fields, and in particular to a kind of data compression method and relevant apparatus.
Background technique
With the development of artificial intelligence, neural network role is increasingly heavier, especially convolutional neural networks (Convolutional Neural Networks, CNN).In the calculating process of neural network model, data, weight are to being The bandwidth demand of system is larger, and it is extremely urgent to reduce demand of the neural network model to bandwidth.
Currently, using column compression (Compressed Column Storage, CCS) and row compression (Compressed Row Storage, CRS) data in neural network model to be compressed, the compression efficiency of both compress modes is not high.
Summary of the invention
The embodiment of the present application provides a kind of data compression method and relevant apparatus, for improving the number in neural network model According to compression efficiency.
In a first aspect, the embodiment of the present application provides a kind of data compression method, applied to the neural network including N layers of structure Model, the N are the integer greater than 1, which comprises
The output data set of i-th layer of structure in the neural network model is obtained, the output data set includes The matrix of at least one m × n, the m and the n are the integer greater than 1, and the i is 1 any one into the N;
Packet segmentation is carried out to the matrix of at least one m × n, the M after being divided first data packet is described M is the integer more than or equal to 1;
Data compression is carried out to the M the first data packets, two the second data packets after obtaining data compression.
In a possible example, the output data set for obtaining i-th layer of structure in the neural network model It closes, comprising:
As i=1, the input data set of the 1st layer of structure in the neural network model, the 1st layer of knot are obtained The input data set of structure includes at least one first matrix;
The weight data set for obtaining the 1st layer of structure, the weight data set of the 1st layer of structure is decompressed Contracting, obtains the second matrix, and second matrix is the weight data set of the 1st layer of structure after decompression;
The output data set of the 1st layer of structure is determined based at least one described first matrix and second matrix It closes;
As 2≤i≤N, the output data set of (i-1)-th layer of structure in the neural network model is obtained, described The output data set of i-1 layers of structure includes at least one third matrix;
The weight data set for obtaining i-th layer of structure decompresses the weight data set of i-th layer of structure Contracting, obtains the 4th matrix, and the 4th matrix is the weight data set of i-th layer of structure after decompression;
The output data set of i-th layer of structure is determined based at least one described third matrix and the 4th matrix It closes.
In a possible example, the matrix at least one m × n carries out packet segmentation, is divided M the first data packets after cutting, comprising:
The matrix of at least one m × n is subjected to array conversion, obtains one-dimension array, the one-dimension array is array The matrix of at least one m × n after conversion;
The one-dimension array is subjected to packet segmentation, the M after being divided first data packet, the 1st first Data packet to the first data packet of each of M-1 the first data packets includes P data, and the first data packet of m-th includes Q A data, the P are the integer more than or equal to 1, and the Q is the integer more than or equal to 1 and less than or equal to the P.
It is described that data compression is carried out to the M the first data packets in a possible example, after obtaining data compression Two the second data packets, comprising:
The packet information of j-th of first data packets is obtained, the packet information of j-th of first data packets includes P The length of a indication signal, the first data acquisition system and j-th of first data packets, the indication signal are used to indicate described Whether each data in P data that j the first data packets include are zero, and first data acquisition system includes described j-th At least one non-zero in P data that first data packet includes, j-th of first data packets are described 1st the Any one of one data packet into the M-1 the first data packets;
To the 1st first data packet into the M-1 the first data packets except j-th of first data packets it M-2 outer the first data packets execute identical operation, obtain the first data packet of each of the M-2 the first data packets Packet information;
Obtain the packet information of first data packet of m-th, the packet information packet of first data packet of m-th The length of the first data packet of Q indication signal, the second data set and the m-th is included, the indication signal is used to indicate institute Whether each data stated in the Q data that the first data packet of m-th includes are zero, and the second data set includes described At least one non-zero in Q data that M the first data packets include;
The P for including to the first data packet of each of the M-1 the first data packets by the 1st first data packet A indication signal and the first data acquisition system form the first subdata packet, obtain M-1 the first subdata packets;
Q indication signal and the second data set composition the first subnumber of m-th for including by first data packet of m-th According to packet;
Sequence based on the M the first data packet is by the M-1 the first subnumbers of the first subdata packet and the m-th The 1st the second data packet is formed according to packet;
The length of the M the first data packets is formed the 2nd the second data by the sequence based on the M the first data packets Packet.
It is described that data compression is carried out to the M the first data packets in a possible example, after obtaining data compression Two the second data packets after, the method also includes:
Identical operation is executed to the N-1 layer structure in the N layers of structure in addition to i-th layer of structure, is obtained described Corresponding two the second data packets of every layer of structure in N-1 layers of structure;
Corresponding 2N the second data packet of the N layers of structure is stored to Double Data Rate synchronous DRAM DDR In.
Second aspect, the embodiment of the present application provides a kind of data compression compression set, applied to the nerve including N layers of structure Network model, the N are the integer greater than 1, and described device includes:
Acquiring unit, for obtaining the output data set of i-th layer of structure in the neural network model, the output Data acquisition system includes the matrix of at least one m × n, and the m and the n are the integer greater than 1, and the i is 1 into the N Any one;
Cutting unit, for carrying out packet segmentation to the matrix of at least one m × n, the M after divide a the One data packet, the M are the integer more than or equal to 1;
Compression unit, for carrying out data compression to the M the first data packets, two second after obtaining data compression Data packet.
In a possible example, in the output data set for obtaining i-th layer of structure in the neural network model Aspect, the acquiring unit are specifically used for:
As i=1, the input data set of the 1st layer of structure in the neural network model, the 1st layer of knot are obtained The input data set of structure includes at least one first matrix;
The weight data set for obtaining the 1st layer of structure, the weight data set of the 1st layer of structure is decompressed Contracting, obtains the second matrix, and second matrix is the weight data set of the 1st layer of structure after decompression;
The output data set of the 1st layer of structure is determined based at least one described first matrix and second matrix It closes;
As 2≤i≤N, the output data set of (i-1)-th layer of structure in the neural network model is obtained, described The output data set of i-1 layers of structure includes at least one third matrix;
The weight data set for obtaining i-th layer of structure decompresses the weight data set of i-th layer of structure Contracting, obtains the 4th matrix, and the 4th matrix is the weight data set of i-th layer of structure after decompression;
The output data set of i-th layer of structure is determined based at least one described third matrix and the 4th matrix It closes.
In a possible example, packet segmentation is carried out in the matrix at least one m × n, is divided In terms of M the first data packets afterwards, the cutting unit is specifically used for:
The matrix of at least one m × n is subjected to array conversion, obtains one-dimension array, the one-dimension array is array The matrix of at least one m × n after conversion;
The one-dimension array is subjected to packet segmentation, the M after being divided first data packet, the 1st first Data packet to the first data packet of each of M-1 the first data packets includes P data, and the first data packet of m-th includes Q A data, the P are the integer more than or equal to 1, and the Q is the integer more than or equal to 1 and less than or equal to the P.
In a possible example, data compression is being carried out to the M the first data packets, after obtaining data compression In terms of two the second data packets, the compression unit is specifically used for:
The packet information of j-th of first data packets is obtained, the packet information of j-th of first data packets includes P The length of a indication signal, the first data acquisition system and j-th of first data packets, the indication signal are used to indicate described Whether each data in P data that j the first data packets include are zero, and first data acquisition system includes described j-th At least one non-zero in P data that first data packet includes, j-th of first data packets are described 1st the Any one of one data packet into the M-1 the first data packets;
To the 1st first data packet into the M-1 the first data packets except j-th of first data packets it M-2 outer the first data packets execute identical operation, obtain the first data packet of each of the M-2 the first data packets Packet information;
Obtain the packet information of first data packet of m-th, the packet information packet of first data packet of m-th The length of the first data packet of Q indication signal, the second data set and the m-th is included, the indication signal is used to indicate institute Whether each data stated in the Q data that the first data packet of m-th includes are zero, and the second data set includes described At least one non-zero in Q data that M the first data packets include;
The P for including to the first data packet of each of the M-1 the first data packets by the 1st first data packet A indication signal and the first data acquisition system form the first subdata packet, obtain M-1 the first subdata packets;
Q indication signal and the second data set composition the first subnumber of m-th for including by first data packet of m-th According to packet;
Sequence based on the M the first data packet is by the M-1 the first subnumbers of the first subdata packet and the m-th The 1st the second data packet is formed according to packet;
The length of the M the first data packets is formed the 2nd the second data by the sequence based on the M the first data packets Packet.
In a possible example, the data compression device further include:
Execution unit, it is identical for being executed to the N-1 layer structure in the N layers of structure in addition to i-th layer of structure Operation, obtains corresponding two the second data packets of every layer of structure in the N-1 layers of structure;
Storage unit is used for corresponding 2N the second data packet storage value Double Data Rate synchronous dynamic of the N layers of structure In random access memory DDR.
The third aspect, the embodiment of the present application provide a kind of electronic equipment, including processor, memory, communication interface, and One or more programs, said one or multiple programs are stored in above-mentioned memory, and are configured by above-mentioned processor It executes, above procedure is included the steps that for executing the instruction in method described in the embodiment of the present application first aspect.
Fourth aspect, the embodiment of the present application provide a kind of computer readable storage medium, above-mentioned computer-readable storage For storing computer program, above-mentioned computer program is executed by processor medium, to realize such as the embodiment of the present application first party Step some or all of described in method described in face.
5th aspect, the embodiment of the present application provide a kind of computer program product, and above-mentioned computer program product includes The non-transient computer readable storage medium of computer program is stored, above-mentioned computer program is operable to hold computer Step some or all of described in method of the row as described in the embodiment of the present application first aspect.The computer program product can Think a software installation packet.
As can be seen that in the embodiment of the present application, data compression device obtains i-th layer of structure in neural network model Output data set, output data set include the matrix of at least one m × n, carry out data to the matrix of at least one m × n Packet segmentation, M the first data packets after being divided carry out data compression to M the first data packets, after obtaining data compression Two the second data packets.In this way by counting the Factorization algorithm of at least one m × n at M the first data packets, and by M first Two the second data packets are compressed into according to packet, realizes and shortens output data set combined pressure into two the second data packets, and then improve The compression efficiency of data in neural network model.
These aspects or other aspects of the application can more straightforward in the following description.
Detailed description of the invention
Technical solution in ord to more clearly illustrate embodiments of the present application or in background technique below will be implemented the application Attached drawing needed in example or background technique is illustrated.
Figure 1A is a kind of flow diagram of data compression method provided by the embodiments of the present application;
Figure 1B is a kind of schematic diagram provided by the embodiments of the present application;
Fig. 1 C is another schematic diagram provided by the embodiments of the present application;
Fig. 1 D is another schematic diagram provided by the embodiments of the present application;
Fig. 2 is the flow diagram of another data compression method provided by the embodiments of the present application;
Fig. 3 is the flow diagram of another data compression method provided by the embodiments of the present application;
Fig. 4 is a kind of functional unit composition block diagram of data compression device provided by the embodiments of the present application;
Fig. 5 is the structural schematic diagram of a kind of electronic equipment provided by the embodiments of the present application.
Specific implementation
In order to make those skilled in the art more fully understand application scheme, below in conjunction in the embodiment of the present application Attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment is only The embodiment of the application a part, instead of all the embodiments.Based on the embodiment in the application, ordinary skill people Member's every other embodiment obtained without making creative work, all should belong to the model of the application protection It encloses.
It is described in detail separately below.
The description and claims of this application and term " first ", " second ", " third " and " in the attached drawing Four " etc. are not use to describe a particular order for distinguishing different objects.In addition, term " includes " and " having " and it Any deformation, it is intended that cover and non-exclusive include.Such as it contains the process, method of a series of steps or units, be System, product or equipment are not limited to listed step or unit, but optionally further comprising the step of not listing or list Member, or optionally further comprising other step or units intrinsic for these process, methods, product or equipment.
Referenced herein " embodiment " is it is meant that a particular feature, structure, or characteristic described can wrap in conjunction with the embodiments It is contained at least one embodiment of the application.Each position in the description occur the phrase might not each mean it is identical Embodiment, nor the independent or alternative embodiment with other embodiments mutual exclusion.Those skilled in the art explicitly and Implicitly understand, embodiment described herein can be combined with other embodiments.
Data compression device involved in the embodiment of the present application can integrate in the electronic device, and electronic equipment may include each Kind has the handheld device of wireless communication function, mobile unit, wearable device, calculates equipment or be connected to wireless modulation-demodulation Other processing equipments of device and various forms of user equipmenies (user equipment, UE), mobile station (mobile Station, MS), terminal device (terminal device) etc..For convenience of description, apparatus mentioned above is referred to as electronics Equipment.
It describes in detail below to the embodiment of the present application.
Figure 1A is please referred to, Figure 1A is a kind of flow diagram of data compression method provided by the embodiments of the present application, application In the neural network model including N layers of structure, the N is the integer greater than 1, which includes:
Step 101: data compression device obtains the output data set of i-th layer of structure in the neural network model, The output data set includes the matrix of at least one m × n, and the m and the n are the integer greater than 1, the i be 1 to Any one in the N.
Wherein, by taking convolutional neural networks as an example, N layers of structure include input layer, convolutional layer, pond layer and full articulamentum.
In a possible example, data compression device obtains the defeated of i-th layer of structure in the neural network model Data acquisition system out, comprising:
As i=1, data compression device obtains the input data set of the 1st layer of structure in the neural network model, The input data set of the 1st layer of structure includes at least one first matrix;
Data compression device obtains the weight data set of the 1st layer of structure, by the weight data of the 1st layer of structure Set unzips it, and obtains the second matrix, and second matrix is the weight data collection of the 1st layer of structure after decompression It closes;
Data compression device determines the 1st layer of structure based at least one described first matrix and second matrix Output data set;
As 2≤i≤N, data compression device obtains the output data of (i-1)-th layer of structure in the neural network model Set, the output data set of (i-1)-th layer of structure includes at least one third matrix;
Data compression device obtains the weight data set of i-th layer of structure, by the weight data of i-th layer of structure Set unzips it, and obtains the 4th matrix, and the 4th matrix is the weight data collection of i-th layer of structure after decompression It closes;
Data compression device determines i-th layer of structure based at least one described third matrix and the 4th matrix Output data set.
Wherein, the output data set of the 1st layer of structure is combined into the product of at least one the first matrix and the second matrix, Mei Ge One matrix column number is identical as the line number of the second matrix.
Wherein, the output data set of i-th layer of structure is combined into the product of at least one third matrix and the 4th matrix, Mei Ge Three matrix column numbers are identical as the line number of the 4th matrix.
Step 102: data compression device carries out packet segmentation to the matrix of at least one m × n, after obtaining segmentation M the first data packets, the M is the integer more than or equal to 1.
In a possible example, data compression device carries out data packet point to the matrix of at least one m × n It cuts, the M after being divided first data packets, comprising:
The matrix of at least one m × n is carried out array conversion by data compression device, obtains one-dimension array, and described one Dimension group is the matrix of at least one m × n after array conversion;
The one-dimension array is carried out packet segmentation by data compression device, the M after being divided first data Packet, the 1st the first data packet to the first data packet of each of M-1 the first data packet include P data, m-th the One data packet includes Q data, and the P is the integer more than or equal to 1, and the Q is more than or equal to 1 and less than or equal to institute State the integer of P.
Wherein, the size of each data in P data and Q data is all the same.
For example, as shown in Figure 1B, it is assumed that 8 × 8 matrix (a) is carried out array and turned by P 10, data compression device It changes, obtains one-dimension array (b), one-dimensional data (b) includes 64 data, and one-dimension array (b) is carried out packet segmentation, is divided 7 the first data packets (c) after cutting, the 1st the first data packet to the first data packet of each of the 6th the first data packet are wrapped 10 data are included, the 7th the first data packet includes 4 data.
For example, as shown in Figure 1 C, it is assumed that two 8 × 8 matrixes (d) are carried out array by P 16, data compression device Conversion obtains one-dimension array (e), and one-dimensional data (e) includes 128 data, and one-dimension array (e) is carried out packet segmentation, is obtained 8 the first data packets (f) after to segmentation, the 1st the first data packet to the first data packet of each of the 8th the first data packet It include 16 data.
Step 103: data compression device carries out data compression to the M the first data packets, after obtaining data compression Two the second data packets.
In a possible example, data compression device carries out data compression to the M the first data packets, is counted According to compressed two the second data packets, comprising:
Data compression device obtains the packet information of j-th of first data packets, the data of j-th of first data packets Package informatin includes the length of P indication signal, the first data acquisition system and j-th of first data packets, and the indication signal is used Whether each data in the P data that instruction j-th of first data packets include are zero, the first data acquisition system packet At least one non-zero in the P data that j-th of first data packets include is included, j-th of first data packets are Any one of 1st first data packet into the M-1 the first data packets;
Data compression device removes described j-th the 1st first data packet into the M-1 the first data packets M-2 the first data packets except first data packet execute identical operation, obtain each of the M-2 first data packets The packet information of first data packet;
Data compression device obtains the packet information of first data packet of m-th, first data packet of m-th Packet information includes the length of the first data packet of Q indication signal, the second data set and the m-th, the instruction letter Whether number each data being used to indicate in the Q data that first data packet of m-th includes are zero, second data set Close at least one non-zero in Q data for including including first data packet of m-th;
Data compression device is by each of described 1st first data packet to the M-1 the first data packet first The P indication signal and the first data acquisition system that data packet includes form the first subdata packet, obtain M-1 the first subdata packets;
Q indication signal and the second data set composition that first data packet of m-th is included by data compression device M-th the first subdata packet;
Sequence of the data compression device based on the M the first data packet is by the M-1 the first subdata packets and described M-th the first subdata packet forms the 1st the second data packet;
Sequence of the data compression device based on the M the first data packets forms the length of the M the first data packets 2nd the second data packet.
Wherein, the sequence and the sequence phase of M the first data packets of the M in the 1st the second data packet the first subdata packets Together, i.e. M the first subdata packets and M the first data packets correspond.
Wherein, the sequence of the length of the M in the 2nd the second data packet the first data packets and the row of M the first data packets Sequence is identical, i.e. the length and M the first data packets one-to-one correspondence of M the first data packets.
For example, as shown in figure iD, it is assumed that 3,3 the first data packets of M are ordered as the 1st the first data packet to 3 the first data packets are arranged successively, and data compression device obtains the packet information of 3 the first data packets, the 1st the first data The packet information of packet includes 16 indication signals (16bit), 12 non-zeros (data 1- data 12) and the 1st first number Length according to packet is 64bit, and the packet information of the 2nd the first data packet includes 16 indication signals (16bit), 10 non-zeros The length of data (data 13- data 22) and the 2nd the first data packet is 56bit, the packet information of the 3rd the first data packet It is including 16 indication signals (16bit), 11 non-zeros (data 23- data 33) and the length of the 3rd the first data packet 60bit, the indication signal for including by the first data packet of each of 3 first data packets and non-zero form the first subdata Packet, obtains 3 the first subdata packets, 3 the first subdata packets are formed the 1st second by the sequence based on 3 the first data packets The length of 3 the first data packets is formed the 2nd the second data packet (h) by data packet (g), the sequence based on 3 the first data packets.
As can be seen that in the embodiment of the present application, data compression device obtains i-th layer of structure in neural network model Output data set, output data set include the matrix of at least one m × n, carry out data to the matrix of at least one m × n Packet segmentation, M the first data packets after being divided carry out data compression to M the first data packets, after obtaining data compression Two the second data packets.In this way by counting the Factorization algorithm of at least one m × n at M the first data packets, and by M first Two the second data packets are compressed into according to packet, realizes and shortens output data set combined pressure into two the second data packets, and then improve The compression efficiency of data in neural network model.
In a possible example, data compression device carries out data compression to the M the first data packets, is counted After compressed two the second data packets, the method also includes:
Data compression device executes identical behaviour to the N-1 layer structure in the N layers of structure in addition to i-th layer of structure Make, obtains corresponding two the second data packets of every layer of structure in the N-1 layers of structure;
Data compression device by corresponding 2N the second data packets of the N layers of structure store to Double Data Rate synchronous dynamic with In machine memory DDR.
As it can be seen that in this example, data compression device stores corresponding 2N the second data packet of N layers of structure into DDR, Since 2N the second data packets are stored into DDR the mode for piece external storage, reduce in neural network model The occupancy of portion's memory space.
In a possible example, data compression device stores corresponding 2N the second data packet of the N layers of structure After into DDR, the method also includes:
Data compression device obtains the first position of data to be found, and the first position is the data to be found in institute State the pth row q column in the objective matrix that the output data set of i-th layer of structure includes, 1≤p≤m, 1≤q≤n;
Data compression device determines the length for reading R the first data packets, the R based on the first position and the P For [((p-1) × n+q)/P] rounding;
Data compression device determines the 1st the first data packet based on corresponding 2nd the second data packet of i-th layer of structure Length to the sum of the length of R the first data packet be S;
Data compression device reads the S+1 indication signal in corresponding 1st the second data packet of i-th layer of structure To [S+ ((p-1) × n+q)-R × P] a indication signal;
Data compression device is based on the S+1 indication signal to [S+ ((p-1) × n+q)-R × P] a finger Show that signal determines that the second position of the data to be found, the second position are that the data to be found are tied at described i-th layer Serial number in corresponding 1st the second data packet of structure;
Data compression device reads the second position from corresponding 1st the second data packet of i-th layer of structure Target data, the target data are the data to be found.
Specifically, data compression device is based on the S+1 indication signal to [S+ ((p-1) × n+q)-R × P] a instruction Signal determines the embodiment of the second position of data to be found are as follows: data compression device determines the S+1 indication signal to The number of non-zero indication signal is T in [S+ ((p-1) × n+q)-R × P] a indication signal;Data compression device determines to be found The second position of data is S+P+T.
As an example it is assumed that i-th layer of structure is convolutional layer, each non-zero is 4bit, the output data set of convolutional layer It is combined into 8 × 8 matrix, P 16, data compression device obtains the 7th in the matrix that the first position of data to be found is 8 × 8 Row the 4th arranges, and the length for reading 3 the first data packets is determined based on first position and P, it is 2nd second corresponding to obtain convolutional layer The length of the 1st the first data packet in data packet is 64bit, the 1st the first data packet includes 12 non-zeros, the 2nd The length of first data packet is that the length of 56bit and the 3rd the first data packet is 60bit, determines the length of the 1st the first data packet Degree to the sum of the length of the 3rd the first data packet is 180bit, reads the in corresponding 1st the second data packet of convolutional layer 181 indication signals determine that the 181st indication signal non-zero into the 184th indication signal indicates to the 184th indication signal The number of signal is 4, determines that the second position of data to be found is 200, reads from corresponding 1st the second data packet of convolutional layer The 200th data are taken, the 200th data are data to be found.
As it can be seen that in this example, data compression device is determined based on the first position of data to be found and P reads R the The length of one data packet determines that the length of the 1st the first data packet to the sum of the length of R the first data packets is S, reads the The S+1 indication signal in corresponding 1st the second data packet of i layers of structure is to [S+ ((p-1) × n+q)-R × P] a finger Show signal, data to be found are determined based on the S+1 indication signal to [S+ ((p-1) × n+q)-R × P] a indication signal The target data of the second position is read in the second position from corresponding 1st the second data packet of i-th layer of structure.In this way by The first position and P of searching data determine the length of R the first data packet, based on R the first data packets length determine it is to be checked The second position of data is looked for, and then realizes and quickly positions from variable length compressed data by the position of compression source data.
It is consistent with above-mentioned embodiment shown in figure 1A, referring to Fig. 2, Fig. 2 is another kind provided by the embodiments of the present application The flow diagram of data compression method, the data compression method include:
Step 201: data compression device obtains the output data set of i-th layer of structure in the neural network model, The output data set includes the matrix of at least one m × n, and the m and the n are the integer greater than 1, the i be 1 to Any one in the N.
Step 202: the matrix of at least one m × n is carried out array conversion by data compression device, obtains a dimension Group, the one-dimension array are the matrix of at least one m × n after array conversion.
Step 203: the one-dimension array is carried out packet segmentation by data compression device, and the M after being divided First data packet, the 1st the first data packet to the first data packet of each of M-1 the first data packets includes P data, The first data packet of m-th includes Q data, and the M is the integer more than or equal to 1, and the P is the integer more than or equal to 1, The Q is the integer more than or equal to 1 and less than or equal to the P.
Step 204: data compression device obtains the packet information of j-th of first data packets, j-th of first data The packet information of packet includes the length of P indication signal, the first data acquisition system and j-th of first data packets, the finger Whether each data for showing that signal is used to indicate in the P data that j-th of first data packets include are zero, first number At least one non-zero in P data for including including j-th of first data packets according to set, described j-th first Data packet is any one of the 1st first data packet into the M-1 the first data packets.
Step 205: data compression device removes the 1st first data packet into the M-1 the first data packets M-2 the first data packets except j-th of first data packets execute identical operation, obtain the M-2 the first data The packet information of the first data packet of each of packet.
Step 206: data compression device obtains the packet information of first data packet of m-th, the m-th first The packet information of data packet includes the length of the first data packet of Q indication signal, the second data set and the m-th, institute State whether each data that indication signal is used to indicate in the Q data that first data packet of m-th includes are zero, described Two data acquisition systems include at least one non-zero in the Q data that first data packet of m-th includes.
Step 207: data compression device is by the 1st first data packet into the M-1 the first data packets The P indication signal and the first data acquisition system that each first data packet includes form the first subdata packet, obtain M-1 first son Data packet.
Step 208: the Q indication signal and the second data that first data packet of m-th is included by data compression device Collection is combined into m-th the first subdata packet.
Step 209: sequence of the data compression device based on the M the first data packet is by the M-1 the first subdatas Packet and the first subdata of m-th packet form the 1st the second data packet.
Step 210: sequence of the data compression device based on the M the first data packet is by the M the first data packets Length forms the 2nd the second data packet.
It should be noted that the specific implementation process of each step of method shown in Fig. 2 can be found in described in the above method Specific implementation process, no longer describe herein.
It is consistent with above-mentioned Figure 1A and embodiment shown in Fig. 2, referring to Fig. 3, Fig. 3 is provided by the embodiments of the present application another A kind of flow diagram of data compression method, the data compression method include:
Step 301: data compression device obtains the output data set of i-th layer of structure in the neural network model, The output data set includes the matrix of at least one m × n, and the m and the n are the integer greater than 1, the i be 1 to Any one in the N.
Step 302: the matrix of at least one m × n is carried out array conversion by data compression device, obtains a dimension Group, the one-dimension array are the matrix of at least one m × n after array conversion.
Step 303: the one-dimension array is carried out packet segmentation by data compression device, and the M after being divided First data packet, the 1st the first data packet to the first data packet of each of M-1 the first data packets includes P data, The first data packet of m-th includes Q data, and the M is the integer greater than 1, and the P is the integer more than or equal to 1, the Q For the integer more than or equal to 1 and less than or equal to the P.
Step 304: data compression device obtains the packet information of j-th of first data packets, j-th of first data The packet information of packet includes the length of P indication signal, the first data acquisition system and j-th of first data packets, the finger Whether each data for showing that signal is used to indicate in the P data that j-th of first data packets include are zero, first number At least one non-zero in P data for including including j-th of first data packets according to set, described j-th first Data packet is any one of the 1st first data packet into the M-1 the first data packets.
Step 305: data compression device removes the 1st first data packet into the M-1 the first data packets M-2 the first data packets except j-th of first data packets execute identical operation, obtain the M-2 the first data The packet information of the first data packet of each of packet.
Step 306: data compression device obtains the packet information of first data packet of m-th, the m-th first The packet information of data packet includes the length of the first data packet of Q indication signal, the second data set and the m-th, institute State whether each data that indication signal is used to indicate in the Q data that first data packet of m-th includes are zero, described Two data acquisition systems include at least one non-zero in the Q data that first data packet of m-th includes.
Step 307: data compression device is by the 1st first data packet into the M-1 the first data packets The P indication signal and the first data acquisition system that each first data packet includes form the first subdata packet, obtain M-1 first son Data packet.
Step 308: the Q indication signal and the second data that first data packet of m-th is included by data compression device Collection is combined into m-th the first subdata packet.
Step 309: sequence of the data compression device based on the M the first data packet is by the M-1 the first subdatas Packet and the first subdata of m-th packet form the 1st the second data packet.
Step 310: sequence of the data compression device based on the M the first data packet is by the M the first data packets Length forms the 2nd the second data packet.
Step 311: data compression device executes the N-1 layer structure in the N layers of structure in addition to i-th layer of structure Identical operation obtains corresponding two the second data packets of every layer of structure in the N-1 layers of structure.
Step 312: data compression device stores corresponding 2N the second data packet of the N layers of structure same to Double Data Rate It walks in dynamic RAM DDR.
It should be noted that the specific implementation process of each step of method shown in Fig. 3 can be found in described in the above method Specific implementation process, no longer describe herein.
Above-described embodiment is mainly described the scheme of the embodiment of the present application from the angle of method side implementation procedure.It can With understanding, data compression device in order to realize the above functions, it comprises execute each corresponding hardware configuration of function and/ Or software module.Those skilled in the art should be readily appreciated that, described in conjunction with the examples disclosed in this document respectively to show The unit and algorithm steps of example, the application can be realized with the combining form of hardware or hardware and computer software.Some function It can be executed in a manner of hardware or computer software driving hardware actually, the specific application and design depending on technical solution Constraint condition.Professional technician can specifically realize described function to each using distinct methods, still It is this to realize it is not considered that exceeding scope of the present application.
The embodiment of the present application can carry out the division of functional unit, example according to the method example compressing data device Such as, each functional unit of each function division can be corresponded to, two or more functions can also be integrated at one It manages in unit.The integrated unit both can take the form of hardware realization, can also be in the form of software functional units It realizes.It should be noted that being schematical, only a kind of logic function stroke to the division of unit in the embodiment of the present application Point, there may be another division manner in actual implementation.
It is below the application Installation practice, the application Installation practice is realized for executing the application embodiment of the method Method.Referring to Fig. 4, Fig. 4 is a kind of functional unit composition frame of data compression device 400 provided by the embodiments of the present application Figure, the data compression device 400 are applied to the neural network model including N layers of structure, and the N is the integer greater than 1, the data Compression set 400 includes:
Acquiring unit 401, it is described for obtaining the output data set of i-th layer of structure in the neural network model Output data set includes the matrix of at least one m × n, and the m and the n are the integer greater than 1, and the i is 1 to described Any one in N;
Cutting unit 402 carries out packet segmentation for the matrix at least one m × n, the M after being divided A first data packet, the M are the integer more than or equal to 1;
Compression unit 403, for carrying out data compression to the M the first data packets, two after obtaining data compression Second data packet.
As can be seen that in the embodiment of the present application, data compression device obtains i-th layer of structure in neural network model Output data set, output data set include the matrix of at least one m × n, carry out data to the matrix of at least one m × n Packet segmentation, M the first data packets after being divided carry out data compression to M the first data packets, after obtaining data compression Two the second data packets.In this way by counting the Factorization algorithm of at least one m × n at M the first data packets, and by M first Two the second data packets are compressed into according to packet, realizes and shortens output data set combined pressure into two the second data packets, and then improve The compression efficiency of data in neural network model.
In a possible example, in the output data set for obtaining i-th layer of structure in the neural network model Aspect, above-mentioned acquiring unit 401 are specifically used for:
As i=1, the input data set of the 1st layer of structure in the neural network model, the 1st layer of knot are obtained The input data set of structure includes at least one first matrix;
The weight data set for obtaining the 1st layer of structure, the weight data set of the 1st layer of structure is decompressed Contracting, obtains the second matrix, and second matrix is the weight data set of the 1st layer of structure after decompression;
The output data set of the 1st layer of structure is determined based at least one described first matrix and second matrix It closes;
As 2≤i≤N, the output data set of (i-1)-th layer of structure in the neural network model is obtained, described The output data set of i-1 layers of structure includes at least one third matrix;
The weight data set for obtaining i-th layer of structure decompresses the weight data set of i-th layer of structure Contracting, obtains the 4th matrix, and the 4th matrix is the weight data set of i-th layer of structure after decompression;
The output data set of i-th layer of structure is determined based at least one described third matrix and the 4th matrix It closes.
In a possible example, packet segmentation is carried out in the matrix at least one m × n, is divided In terms of M the first data packets afterwards, above-mentioned cutting unit 402 is specifically used for:
The matrix of at least one m × n is subjected to array conversion, obtains one-dimension array, the one-dimension array is array The matrix of at least one m × n after conversion;
The one-dimension array is subjected to packet segmentation, the M after being divided first data packet, the 1st first Data packet to the first data packet of each of M-1 the first data packets includes P data, and the first data packet of m-th includes Q A data, the P are the integer more than or equal to 1, and the Q is the integer more than or equal to 1 and less than or equal to the P.
In a possible example, data compression is being carried out to the M the first data packets, after obtaining data compression In terms of two the second data packets, above-mentioned compression unit 403 is specifically used for:
The packet information of j-th of first data packets is obtained, the packet information of j-th of first data packets includes P The length of a indication signal, the first data acquisition system and j-th of first data packets, the indication signal are used to indicate described Whether each data in P data that j the first data packets include are zero, and first data acquisition system includes described j-th At least one non-zero in P data that first data packet includes, j-th of first data packets are described 1st the Any one of one data packet into the M-1 the first data packets;
To the 1st first data packet into the M-1 the first data packets except j-th of first data packets it M-2 outer the first data packets execute identical operation, obtain the first data packet of each of the M-2 the first data packets Packet information;
Obtain the packet information of first data packet of m-th, the packet information packet of first data packet of m-th The length of the first data packet of Q indication signal, the second data set and the m-th is included, the indication signal is used to indicate institute Whether each data stated in the Q data that the first data packet of m-th includes are zero, and the second data set includes described At least one non-zero in Q data that M the first data packets include;
The P for including to the first data packet of each of the M-1 the first data packets by the 1st first data packet A indication signal and the first data acquisition system form the first subdata packet, obtain M-1 the first subdata packets;
Q indication signal and the second data set composition the first subnumber of m-th for including by first data packet of m-th According to packet;
Sequence based on the M the first data packet is by the M-1 the first subnumbers of the first subdata packet and the m-th The 1st the second data packet is formed according to packet;
The length of the M the first data packets is formed the 2nd the second data by the sequence based on the M the first data packets Packet.
In a possible example, above-mentioned data compression device 400 further include:
Execution unit 404 is identical for executing to the N-1 layer structure in the N layers of structure in addition to i-th layer of structure Operation, obtain corresponding two the second data packets of every layer of structure in the N-1 layers of structure;
Storage unit 405, for corresponding 2N the second data packets of the N layers of structure are stored to Double Data Rate synchronize it is dynamic In state random access memory DDR.
It is consistent with above-mentioned Figure 1A, Fig. 2 and embodiment shown in Fig. 3, referring to Fig. 5, Fig. 5 is that the embodiment of the present application provides A kind of electronic equipment structural schematic diagram, which includes processor, memory, communication interface and one or more A program, said one or multiple programs are stored in above-mentioned memory, and are configured to be executed by above-mentioned processor, above-mentioned Program includes the instruction for executing following steps:
The output data set of i-th layer of structure in the neural network model is obtained, the output data set includes The matrix of at least one m × n, the m and the n are the integer greater than 1, and the i is 1 any one into the N;
Packet segmentation is carried out to the matrix of at least one m × n, the M after being divided first data packet is described M is the integer more than or equal to 1;
Data compression is carried out to the M the first data packets, two the second data packets after obtaining data compression.
As can be seen that in the embodiment of the present application, obtaining the output data set of i-th layer of structure in neural network model It closes, output data set includes the matrix of at least one m × n, carries out packet segmentation to the matrix of at least one m × n, obtains M the first data packets after segmentation carry out data compression to M the first data packets, two second numbers after obtaining data compression According to packet.In this way by by the Factorization algorithm of at least one m × n at M the first data packets, and by M the first data packet compressings at Two the second data packets realize and shorten output data set combined pressure into two the second data packets, and then improve neural network mould The compression efficiency of data in type.
In a possible example, in the output data set for obtaining i-th layer of structure in the neural network model Aspect, above procedure include the instruction specifically for executing following steps:
As i=1, the input data set of the 1st layer of structure in the neural network model, the 1st layer of knot are obtained The input data set of structure includes at least one first matrix;
The weight data set for obtaining at least one the 1st layer of structure, by the weight data set of the 1st layer of structure It unzips it, obtains the second matrix, second matrix is the weight data set of the 1st layer of structure after decompression;
The output data set of the 1st layer of structure is determined based at least one described first matrix and second matrix It closes;
As 2≤i≤N, the output data set of (i-1)-th layer of structure in the neural network model is obtained, described The output data set of i-1 layers of structure includes at least one third matrix;
The weight data set for obtaining i-th layer of structure decompresses the weight data set of i-th layer of structure Contracting, obtains the 4th matrix, and the 4th matrix is the weight data set of i-th layer of structure after decompression;
The output data set of i-th layer of structure is determined based at least one described third matrix and the 4th matrix It closes.
In a possible example, packet segmentation is carried out in the matrix at least one m × n, is divided In terms of M the first data packets afterwards, above procedure includes the instruction specifically for executing following steps:
The matrix of at least one m × n is subjected to array conversion, obtains one-dimension array, the one-dimension array is array The matrix of at least one m × n after conversion;
The one-dimension array is subjected to packet segmentation, the M after being divided first data packet, the 1st first Data packet to the first data packet of each of M-1 the first data packets includes P data, and the first data packet of m-th includes Q A data, the P are the integer more than or equal to 1, and the Q is the integer more than or equal to 1 and less than or equal to the P.
In a possible example, data compression is being carried out to the M the first data packets, after obtaining data compression In terms of two the second data packets, above procedure includes the instruction specifically for executing following steps:
The packet information of j-th of first data packets is obtained, the packet information of j-th of first data packets includes P The length of a indication signal, the first data acquisition system and j-th of first data packets, the indication signal are used to indicate described Whether each data in P data that j the first data packets include are zero, and first data acquisition system includes described j-th At least one non-zero in P data that first data packet includes, j-th of first data packets are described 1st the Any one of one data packet into the M-1 the first data packets;
To the 1st first data packet into the M-1 the first data packets except j-th of first data packets it M-2 outer the first data packets execute identical operation, obtain the first data packet of each of the M-2 the first data packets Packet information;
Obtain the packet information of first data packet of m-th, the packet information packet of first data packet of m-th The length of the first data packet of Q indication signal, the second data set and the m-th is included, the indication signal is used to indicate institute Whether each data stated in the Q data that the first data packet of m-th includes are zero, and the second data set includes described At least one non-zero in Q data that M the first data packets include;
The P for including to the first data packet of each of the M-1 the first data packets by the 1st first data packet A indication signal and the first data acquisition system form the first subdata packet, obtain M-1 the first subdata packets;
Q indication signal and the second data set composition the first subnumber of m-th for including by first data packet of m-th According to packet;
Sequence based on the M the first data packet is by the M-1 the first subnumbers of the first subdata packet and the m-th The 1st the second data packet is formed according to packet;
The length of the M the first data packets is formed the 2nd the second data by the sequence based on the M the first data packets Packet.
In a possible example, above procedure further includes the instruction for executing following steps:
Identical operation is executed to the N-1 layer structure in the N layers of structure in addition to i-th layer of structure, is obtained described Corresponding two the second data packets of every layer of structure in N-1 layers of structure;
By corresponding 2N the second data packet storage value Double Data Rate synchronous DRAM DDR of the N layers of structure In.
The embodiment of the present application also provides a kind of computer storage medium, and the computer storage medium is for storing computer journey Sequence, above-mentioned computer program are executed by processor, with realize part as either recorded method in above method embodiment or Overall Steps, above-mentioned computer include electronic equipment.
The embodiment of the present application also provides a kind of computer program product, and above-mentioned computer program product includes storing calculating The non-transient computer readable storage medium of machine program, above-mentioned computer program are operable to that computer is made to execute such as above-mentioned side Some or all of either record method step in method embodiment.The computer program product can be a software installation Packet, above-mentioned computer includes electronic equipment.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of Combination of actions, but those skilled in the art should understand that, the application is not limited by the described action sequence because According to the application, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know It knows, the embodiments described in the specification are all preferred embodiments, related actions and modules not necessarily the application It is necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment Point, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that disclosed device, it can be by another way It realizes.For example, the apparatus embodiments described above are merely exemplary, such as the division of said units, it is only a kind of Logical function partition, there may be another division manner in actual implementation, such as multiple units or components can combine or can To be integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual Coupling, direct-coupling or communication connection can be through some interfaces, the indirect coupling or communication connection of device or unit, It can be electrical or other forms.
Above-mentioned unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme 's.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
If above-mentioned integrated unit is realized in the form of SFU software functional unit and sells or use as independent product When, it can store in a computer-readable access to memory.Based on this understanding, the technical solution of the application substantially or Person says that all or part of the part that contributes to existing technology or the technical solution can body in the form of software products Reveal and, which is stored in a memory, including some instructions are used so that a computer equipment (can be personal computer, server or network equipment etc.) executes all or part of each embodiment above method of the application Step.And memory above-mentioned includes: USB flash disk, read-only memory (ROM, Read-Only Memory), random access memory The various media that can store program code such as (RAM, Random Access Memory), mobile hard disk, magnetic or disk.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of above-described embodiment is can It is completed with instructing relevant hardware by program, which can store in a computer-readable memory, memory May include: flash disk, read-only memory (English: Read-Only Memory, referred to as: ROM), random access device (English: Random Access Memory, referred to as: RAM), disk or CD etc..
The embodiment of the present application is described in detail above, specific case used herein to the principle of the application and Embodiment is expounded, the description of the example is only used to help understand the method for the present application and its core ideas; At the same time, for those skilled in the art can in specific implementation and application range according to the thought of the application There is change place, to sum up above-mentioned, the contents of this specification should not be construed as limiting the present application.

Claims (10)

1. a kind of data compression method, which is characterized in that applied to the neural network model including N layers of structure, the N be greater than 1 integer, which comprises
The output data set of i-th layer of structure in the neural network model is obtained, the output data set includes at least The matrix of one m × n, the m and the n are the integer greater than 1, and the i is 1 any one into the N;
Packet segmentation is carried out to the matrix of at least one m × n, a first data packets of the M after divide, the M is Integer more than or equal to 1;
Data compression is carried out to the M the first data packets, two the second data packets after obtaining data compression.
2. the method according to claim 1, wherein the i-th layer of knot obtained in the neural network model The output data set of structure, comprising:
As i=1, the input data set of the 1st layer of structure in the neural network model is obtained, the 1st layer of structure Input data set includes at least one first matrix;
The weight data set for obtaining the 1st layer of structure, the weight data set of the 1st layer of structure is unziped it, The second matrix is obtained, second matrix is the weight data set of the 1st layer of structure after decompression;
The output data set of the 1st layer of structure is determined based at least one described first matrix and second matrix;
As 2≤i≤N, the output data set of (i-1)-th layer of structure in the neural network model is obtained, described (i-1)-th layer The output data set of structure includes at least one third matrix;
The weight data set for obtaining i-th layer of structure unzips it the weight data set of i-th layer of structure, The 4th matrix is obtained, the 4th matrix is the weight data set of i-th layer of structure after decompression;
The output data set of i-th layer of structure is determined based at least one described third matrix and the 4th matrix.
3. method according to claim 1 or 2, which is characterized in that the matrix at least one m × n carries out Packet segmentation, M the first data packets after being divided, comprising:
The matrix of at least one m × n is subjected to array conversion, obtains one-dimension array, the one-dimension array is array conversion The matrix of at least one m × n afterwards;
The one-dimension array is subjected to packet segmentation, the M after being divided first data packet, the 1st the first data The first data packet of each of M-1 the first data packets of Bao Zhi includes P data, and the first data packet of m-th includes Q number According to the P is the integer more than or equal to 1, and the Q is the integer more than or equal to 1 and less than or equal to the P.
4. according to the method described in claim 3, it is characterized in that, described carry out data compressions to the M the first data packets, Two the second data packets after obtaining data compression, comprising:
The packet information of j-th of first data packets is obtained, the packet information of j-th of first data packets includes P finger Show that the length of signal, the first data acquisition system and j-th of first data packets, the indication signal are used to indicate described j-th Whether each data in P data that the first data packet includes are zero, and first data acquisition system includes described j-th first At least one non-zero in P data that data packet includes, j-th of first data packets are the 1st first number According to any one of packet into the M-1 the first data packets;
To the 1st first data packet into the M-1 the first data packets in addition to j-th of first data packets M-2 the first data packets execute identical operation, obtain the data of the first data packet of each of the M-2 the first data packets Package informatin;
The packet information of first data packet of m-th is obtained, the packet information of first data packet of m-th includes Q The length of the first data packet of a indication signal, the second data set and the m-th, the indication signal are used to indicate described Whether each data in Q data that M the first data packets include are zero, and the second data set includes the m-th At least one non-zero in Q data that first data packet includes;
P finger for including by the 1st first data packet to the first data packet of each of the M-1 the first data packets Show that signal and the first data acquisition system form the first subdata packet, obtains M-1 the first subdata packets;
Q indication signal and the second data set composition the first subdata of m-th for including by first data packet of m-th Packet;
Sequence based on the M the first data packet is by the M-1 the first subdata packets and the m-th the first subdata packet Form the 1st the second data packet;
The length of the M the first data packets is formed the 2nd the second data packet by the sequence based on the M the first data packets.
5. the method according to claim 1, wherein described carry out data compressions to the M the first data packets, After two the second data packets after obtaining data compression, the method also includes:
Identical operation is executed to the N-1 layer structure in the N layers of structure in addition to i-th layer of structure, is obtained N-1 layers described Corresponding two the second data packets of every layer of structure in structure;
Corresponding 2N the second data packet of the N layers of structure is stored into Double Data Rate synchronous DRAM DDR.
6. a kind of data compression device, which is characterized in that applied to the neural network model including N layers of structure, the N be greater than 1 integer, described device include:
Acquiring unit, for obtaining the output data set of i-th layer of structure in the neural network model, the output data Set includes the matrix of at least one m × n, and the m and the n are the integer greater than 1, and the i was 1 appointing into the N Meaning one;
Cutting unit carries out packet segmentation for the matrix at least one m × n, the M after being divided first number According to packet, the M is the integer more than or equal to 1;
Compression unit, for carrying out data compression to the M the first data packets, two the second data after obtaining data compression Packet.
7. device according to claim 6, which is characterized in that carry out data packet in the matrix at least one m × n Segmentation, M the first data packets aspects after being divided, the cutting unit are specifically used for:
The matrix of at least one m × n is subjected to array conversion, obtains one-dimension array, the one-dimension array is array conversion The matrix of at least one m × n afterwards;
The one-dimension array is subjected to packet segmentation, the M after being divided first data packet, the 1st the first data The first data packet of each of M-1 the first data packets of Bao Zhi includes P data, and the first data packet of m-th includes Q number According to the P is the integer more than or equal to 1, and the Q is the integer more than or equal to 1 and less than or equal to the P.
8. device according to claim 7, which is characterized in that carrying out data compression to the M the first data packets, obtaining In terms of two the second data packets after to data compression, the compression unit is specifically used for:
The packet information of j-th of first data packets is obtained, the packet information of j-th of first data packets includes P finger Show that the length of signal, the first data acquisition system and j-th of first data packets, the indication signal are used to indicate described j-th Whether each data in P data that the first data packet includes are zero, and first data acquisition system includes described j-th first At least one non-zero in P data that data packet includes, j-th of first data packets are the 1st first number According to any one of packet into the M-1 the first data packets;
To the 1st first data packet into the M-1 the first data packets in addition to j-th of first data packets M-2 the first data packets execute identical operation, obtain the data of the first data packet of each of the M-2 the first data packets Package informatin;
The packet information of first data packet of m-th is obtained, the packet information of first data packet of m-th includes Q The length of the first data packet of a indication signal, the second data set and the m-th, the indication signal are used to indicate described Whether each data in Q data that M the first data packets include are zero, and the second data set includes the m-th At least one non-zero in Q data that first data packet includes;
P finger for including by the 1st first data packet to the first data packet of each of the M-1 the first data packets Show that signal and the first data acquisition system form the first subdata packet, obtains M-1 the first subdata packets;
Q indication signal and the second data set composition the first subdata of m-th for including by first data packet of m-th Packet;
Sequence based on the M the first data packet is by the M-1 the first subdata packets and the m-th the first subdata packet Form the 1st the second data packet;
The length of the M the first data packets is formed the 2nd the second data packet by the sequence based on the M the first data packets.
9. a kind of electronic equipment, which is characterized in that including processor, memory, communication interface, and one or more programs, One or more of programs are stored in the memory, and are configured to be executed by the processor, described program packet Include the instruction for executing the step in the method according to claim 1 to 5.
10. a kind of computer readable storage medium, which is characterized in that the computer readable storage medium is for storing computer Program, the computer program are executed by processor, to realize the method according to claim 1 to 5.
CN201811641325.2A 2018-12-29 2018-12-29 Data compression method and related device Active CN109800869B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201811641325.2A CN109800869B (en) 2018-12-29 2018-12-29 Data compression method and related device
PCT/CN2019/114731 WO2020134550A1 (en) 2018-12-29 2019-10-31 Data compression method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811641325.2A CN109800869B (en) 2018-12-29 2018-12-29 Data compression method and related device

Publications (2)

Publication Number Publication Date
CN109800869A true CN109800869A (en) 2019-05-24
CN109800869B CN109800869B (en) 2021-03-05

Family

ID=66558223

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811641325.2A Active CN109800869B (en) 2018-12-29 2018-12-29 Data compression method and related device

Country Status (2)

Country Link
CN (1) CN109800869B (en)
WO (1) WO2020134550A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020134550A1 (en) * 2018-12-29 2020-07-02 深圳云天励飞技术有限公司 Data compression method and related device

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106447034A (en) * 2016-10-27 2017-02-22 中国科学院计算技术研究所 Neutral network processor based on data compression, design method and chip
CN107145939A (en) * 2017-06-21 2017-09-08 北京图森未来科技有限公司 A kind of Neural network optimization and device
CN107220702A (en) * 2017-06-21 2017-09-29 北京图森未来科技有限公司 A kind of Neural network optimization and device
CN107239825A (en) * 2016-08-22 2017-10-10 北京深鉴智能科技有限公司 Consider the deep neural network compression method of load balancing
CN107608937A (en) * 2017-09-11 2018-01-19 浙江大学 A kind of machine learning fan condition monitoring method and device based on cloud computing platform
CN107634943A (en) * 2017-09-08 2018-01-26 中国地质大学(武汉) A kind of weights brief wireless sense network data compression method, equipment and storage device
CN107634937A (en) * 2017-08-29 2018-01-26 中国地质大学(武汉) A kind of wireless sense network data compression method, equipment and its storage device
CN108615074A (en) * 2018-04-28 2018-10-02 中国科学院计算技术研究所 Processing with Neural Network system and method based on compressed sensing
CN108615076A (en) * 2018-04-08 2018-10-02 福州瑞芯微电子股份有限公司 A kind of data store optimization method and apparatus based on deep learning chip
CN108763379A (en) * 2018-05-18 2018-11-06 北京奇艺世纪科技有限公司 A kind of data compression method, uncompressing data, device and electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108122030A (en) * 2016-11-30 2018-06-05 华为技术有限公司 A kind of operation method of convolutional neural networks, device and server
CN107590533B (en) * 2017-08-29 2020-07-31 中国科学院计算技术研究所 Compression device for deep neural network
CN107565971B (en) * 2017-09-07 2020-04-14 华为技术有限公司 Data compression method and device
CN107729995A (en) * 2017-10-31 2018-02-23 中国科学院计算技术研究所 Method and system and neural network processor for accelerans network processing unit
CN109800869B (en) * 2018-12-29 2021-03-05 深圳云天励飞技术有限公司 Data compression method and related device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107239825A (en) * 2016-08-22 2017-10-10 北京深鉴智能科技有限公司 Consider the deep neural network compression method of load balancing
CN106447034A (en) * 2016-10-27 2017-02-22 中国科学院计算技术研究所 Neutral network processor based on data compression, design method and chip
CN107145939A (en) * 2017-06-21 2017-09-08 北京图森未来科技有限公司 A kind of Neural network optimization and device
CN107220702A (en) * 2017-06-21 2017-09-29 北京图森未来科技有限公司 A kind of Neural network optimization and device
CN107634937A (en) * 2017-08-29 2018-01-26 中国地质大学(武汉) A kind of wireless sense network data compression method, equipment and its storage device
CN107634943A (en) * 2017-09-08 2018-01-26 中国地质大学(武汉) A kind of weights brief wireless sense network data compression method, equipment and storage device
CN107608937A (en) * 2017-09-11 2018-01-19 浙江大学 A kind of machine learning fan condition monitoring method and device based on cloud computing platform
CN108615076A (en) * 2018-04-08 2018-10-02 福州瑞芯微电子股份有限公司 A kind of data store optimization method and apparatus based on deep learning chip
CN108615074A (en) * 2018-04-28 2018-10-02 中国科学院计算技术研究所 Processing with Neural Network system and method based on compressed sensing
CN108763379A (en) * 2018-05-18 2018-11-06 北京奇艺世纪科技有限公司 A kind of data compression method, uncompressing data, device and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020134550A1 (en) * 2018-12-29 2020-07-02 深圳云天励飞技术有限公司 Data compression method and related device

Also Published As

Publication number Publication date
WO2020134550A1 (en) 2020-07-02
CN109800869B (en) 2021-03-05

Similar Documents

Publication Publication Date Title
US10505671B2 (en) Polar code encoding method and device
CN100414840C (en) Logic circuit device and working method of programable logic circuit
CN109600618A (en) Video-frequency compression method, decompression method, device, terminal and medium
CN108599900A (en) Method, apparatus and equipment for Polarization Coding
CN102694554A (en) Data compression devices, operating methods thereof, and data processing apparatuses including the same
CA2386272A1 (en) Collaborative design
US8358842B2 (en) Electronic device with function of separating panels of digital comic strip and method thereof
CN109740751B (en) Architecture fusion method of neural network model and related device
CN112219210B (en) Signal processing device and signal processing method
CN104199951B (en) Web page processing method and device
CN109962711B (en) Data compression method, electronic equipment and storage medium
CN109240739A (en) A kind of method, apparatus and controlled terminal of rapid configuration BIOS option
CN109491888A (en) Application compatibility test method, device and computer readable storage medium
CN110334800A (en) A kind of lightweight 3D convolutional network system for video identification
CN109800869A (en) Data compression method and relevant apparatus
CN105095212B (en) The method and apparatus for creating Hash table
KR20120054571A (en) Method for coding using polar code by radix-4
CN111694692B (en) Data storage erasure method, device and equipment and readable storage medium
Tausif et al. SFrWF: Segmented fractional wavelet filter based DWT for low memory image coders
CN105207793A (en) Node information obtaining method and system in tree-shaped topological structure
EP1345333B1 (en) Error protection method and error protection device
CN105630999A (en) Data compressing method and device of server
CN107005657A (en) Method, device, chip and the camera of processing data
CN109271543A (en) Display methods, device, terminal and the computer readable storage medium of thumbnail
CN114070901B (en) Data transmitting and receiving method, device and equipment based on multi-data alignment

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