CN107038451B - Network learning method and training method suitable for gray scale picture - Google Patents
Network learning method and training method suitable for gray scale picture Download PDFInfo
- Publication number
- CN107038451B CN107038451B CN201611010902.9A CN201611010902A CN107038451B CN 107038451 B CN107038451 B CN 107038451B CN 201611010902 A CN201611010902 A CN 201611010902A CN 107038451 B CN107038451 B CN 107038451B
- Authority
- CN
- China
- Prior art keywords
- matrix
- gray scale
- value
- columns
- scale picture
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/211—Selection of the most significant subset of features
- G06F18/2111—Selection of the most significant subset of features by using evolutionary computational techniques, e.g. genetic algorithms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- General Engineering & Computer Science (AREA)
- Biophysics (AREA)
- Molecular Biology (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Biomedical Technology (AREA)
- Physiology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Image Processing (AREA)
Abstract
The present invention provides the network learning methods and training method suitable for gray scale picture, including:The pretreatment of gray scale picture is the second matrix;The random coded matrix for generating binaryzation, it is the 4th matrix to be then multiplied by the second matrix;Activation primitive is adjusted to the 6th matrix;Establish the 7th matrix of binaryzation and the 8th matrix of floating number;7th Matrix Multiplication is with the 6th matrix for the 9th matrix;To represent the tenth matrix of character;It is the 11st matrix that tenth matrix, which is subtracted the 9th matrix,;Using the transposed matrix of the 6th matrix as the 12nd matrix;6th Matrix Multiplication is using the 12nd matrix as procedure parameter;12nd matrix divided by procedure parameter are the 13rd matrix;11st Matrix Multiplication is with the 13rd matrix for the 14th matrix;14th matrix is added with the 8th matrix to obtain the 15th matrix, as the 8th new matrix;Using the 15th matrix binaryzation as the 7th new matrix;The present invention reduces byte number when matrix operation, accelerates arithmetic speed, reduces hsrdware requirements.
Description
Technical field
The present invention relates to field of neural networks, are especially adapted for use in network learning method and the training of gray scale picture
Method.
Background technology
With the continuous evolution of computer and information technology, machine learning and pattern-recognition have become and most processed in recent years
Hand can heat one of field.It is gradually being substituted by machine at the image recognition tasks that some needed people to execute in the past, such as vehicle
Board identification, recognition of face and fingerprint recognition etc..Although there has been the solution of relative maturity in these fields, its scheme
The field of application is very limited, and expected recognition effect can only be often can be only achieved in the environment of specified conditions;In addition to this,
Traditional image recognition technology can only often extract the local message of picture, and can not treat the work of all information in test pictures
Identification and classification, have wide range of applications, and recognition accuracy is high.It is more due to being related in existing network learning method
The operation of position floating number, universal calculation amount is excessive, has slowed down arithmetic speed, so the requirement to arithmetic facility is very high.
Invention content
The purpose of the present invention is to provide the network learning methods and training method suitable for gray scale picture, overcome
The difficulty of the prior art, being used alternatingly by binaryzation matrix and floating-point matrix number, when reducing matrix operation
Byte number accelerates arithmetic speed, greatly reduces the requirement to arithmetic facility.
According to an aspect of the present invention, the network learning method suitable for gray scale picture, the nerve net are provided
Network includes a large amount of neuron, and a large amount of gray scale pictures with character graphics, which are respectively supplied to the neuron, to be learnt,
Include c kind characters in the gray scale picture, c belongs to constant, includes the following steps:
S101, a gray scale picture is pre-processed, it, will be described according to the pixel arrangement and character graphics in the gray scale picture
Gray scale picture is converted into a two-dimensional first matrix M1, and the line number of the first matrix M1 is a, and columns b, a, b are big
In 1 constant, the integer of the value ranges of each of the first matrix M1 element values between [0,255];
S102, the line number for converting first matrix to second one-dimensional matrix a M2, the second matrix M2 are a
× b, columns 1, the integer of the value ranges of each of described second matrix M2 element values between [0,255];
S103, the random coded matrix of binaryzation is generated by same random seed to establish a two-dimensional third matrix
The line number of M3, the third matrix M3 are d, and d belongs to the integer more than 0, and columns is a × b, each of described third matrix M3
The element value is 1 or -1;
S104, the third matrix M3 is multiplied by the second matrix M2, obtains a 4th one-dimensional matrix M4, the described 4th
The line number of matrix M4 is d, and the value range of columns 1, each of described 4th matrix M4 element values is [- 255 × (a
× b) ,+255 × (a × b)] integer;
S105, the 4th matrix M4 is adjusted by activation primitive, and each element value displacement is reduced 2nTimes
Only retain integer-bit afterwards, n is variable element, and n belongs to integer, obtains a 6th one-dimensional matrix M6, the 6th matrix M6
Line number be d, the value range of columns 1, each of described 6th matrix M6 element values isBetween integer;
S106, a two-dimensional 7th matrix M7 is established, the line number of the 7th matrix M7 is c, columns d, binaryzation
Each of the 7th matrix M7 element values are -1 or+1;And a two-dimensional 8th matrix M8 is established, the described 8th
The line number of matrix M8 is c, the value range of columns d, each of described 8th matrix M8 element value be [- 1 ,+1] it
Between floating number;
S107, the 7th matrix M7 are multiplied by the 6th matrix M6, obtain a 9th one-dimensional matrix M9, and described
The line number of nine matrix M9 is c, and the value range of columns 1, each of described 9th matrix M9 element values isInteger, the member of every a line in the 9th matrix M9 described in the step S107
Element represents a kind of character;Also, using the character representated by the row where numerical value greatest member value in the 9th matrix M9 as
Predict character;
S108, the tenth one-dimensional matrix M10, the tenth matrix are obtained according to the character for representing presently described gray scale picture
The line number of M10 is c, and columns 1, the element for presetting every a line in the tenth matrix M10 represents a kind of character, described
The element value that a line of the character of presently described gray scale picture is represented in tenth matrix M10 is 2m, m is variable element, and m belongs to whole
It counts, the element value of remaining row is 0 in the tenth matrix M10;
S109, the tenth matrix M10 is subtracted into the 9th matrix M9, obtains one-dimensional the tenth of an expression error
The line number of one matrix M11, the 11st matrix M11 is c, columns 1, each of described 11st matrix M11 members
The value range of plain value isBetween integer;
S110, the transposed matrix for calculating the 6th matrix M6, obtain a 12nd one-dimensional matrix M12, and described the
The line number of 12 matrix M12 is 1, and the value range of the element value in columns d, the 12nd matrix M12 isBetween floating number;
S111, it the 6th matrix M6 is multiplied by the 12nd matrix M12 obtains a procedure parameter num, the process
Parameter num belongs to integer;
S112, the 12nd matrix M12 divided by the procedure parameter num are obtained into a 13rd one-dimensional matrix
The line number of M13, the 13rd matrix M13 are 1, the value range of the element value in columns d, the 13rd matrix M13
ForBetween floating number;
S113, the 11st matrix M11 is multiplied by the 13rd matrix M13, obtains two-dimensional 14th square
The line number of battle array M14, the 14th matrix M14 are c, the value model of the element value in columns d, the 14th matrix M14
Enclose forBetween floating number;
S114, the 14th matrix M14 is added with the 8th matrix M8, obtains a 15th matrix M15, it will
Current the 8th matrix M8 is updated to the 15th matrix M15, and the line number of the 15th matrix M15 is c, and columns is
The value range of element value in d, the 15th matrix M15 isBetween floating number;And
S115, the 15th matrix M15 is subjected to binaryzation, 0 element value will be more than in the 15th matrix M15
It is converted into 1, the element value that 0 is less than or equal in the 15th matrix M15 is converted into -1, obtains a 16th matrix M16,
The line number of the 16th matrix M16 is c, and the element value in columns d, the 16th matrix M16 is -1 or 1;It will be current
The 7th matrix M7 be updated to the 16th matrix M16, return to step S107.
Preferably, the step S101 includes:Each element in first matrix respectively corresponds to the gray scale picture
In a pixel, it is [0,255] that the element value in corresponding first matrix of each pixel, which is value range,
Between integer.
Preferably, the step S102 includes:It will join end to end to form one-dimensional the per a line in two-dimensional first matrix
Two matrixes, wherein the head end of the tail end linking next line of every a line of first matrix.
Preferably, d=a × b × e, e are the integer more than 1.
Preferably, the value range of e is the integer between [5,20].
Preferably, the step S105 includes:According to any one activation the described 4th in following four activation primitive
Each element of matrix M4, the activation primitive include:
ReLU (x)=max (0, x);And
STA (x)=max (0, | x |-α);
Then each element shift after activation is reduced 2nTimes, obtain a 5th one-dimensional matrix M5, the described 5th
The line number of matrix M5 is d, and the value range of columns 1, the element value in the 5th matrix M5 isIt
Between floating number;Wherein x represents each element value in the 4th matrix M4, and α is variable element, the value range of α be [0,
1];
Each element of the 5th matrix M5 is only retained into integer-bit, obtains the 6th matrix M6.
Preferably, the step S105 is replaced with reduces 2 by each element shift of the 4th matrix M4nIt is only protected after times
Integer-bit is stayed, obtains the 6th matrix M6, the line number of the 6th matrix M6 is d, columns 1, in the 6th matrix M6
Each of the value range of the element value be
Preferably, the step S106 includes:Each element value in the 7th matrix M7 and the 8th matrix M8
Initial assignment be 0.
Preferably, in the tenth matrix M10 in the 9th matrix M9 and the step S108 described in the step S107
The character representated by element per a line is arranged according to identical character sequence along column direction from top to bottom.
Preferably, the step S112 is replaced with:By the procedure parameter after the 12nd matrix M12 divided by adjustment
Num obtains a 13rd one-dimensional matrix M13, and the method for adjusting the procedure parameter num is to add to the procedure parameter num
The line number of 1 summation, the 13rd matrix M13 is 1, the value model of the element value in columns d, the 13rd matrix M13
Enclose forBetween floating number.
Preferably, the gray scale picture with character graphics represents arabic numeric characters, English alphabet character, Chinese
It is at least a kind of in character, Japanese character, Korea character.
Preferably, the gray scale picture includes a rows, b row pixels, and the neural network includes at least a × b neuron structure
At input layer, the output layer that c neuron is constituted and d neuron composition hidden layer.
According to another aspect of the present invention, the neural network training method suitable for gray scale picture, the nerve are provided
Network includes a large amount of neuron, and a large amount of gray scale pictures with character graphics are respectively supplied to the neuron
It practises, includes c kind characters in the gray scale picture, c belongs to constant, includes the following steps:
S201, a gray scale picture is pre-processed, it, will be described according to the pixel arrangement and character graphics in the gray scale picture
Gray scale picture is converted into a two-dimensional first matrix M1, and the line number of the first matrix M1 is a, and columns b, a, b are big
In 1 constant, the integer of the value ranges of each of the first matrix M1 element values between [0,255];
S202, the line number for converting first matrix to second one-dimensional matrix a M2, the second matrix M2 are a
× b, columns 1, the integer of the value ranges of each of described second matrix M2 element values between [0,255];
S203, the random coded matrix of binaryzation is generated by same random seed to establish a two-dimensional third matrix
The line number of M3, the third matrix M3 are d, and d belongs to the integer more than 0, and columns is a × b, each of described third matrix M3
The element value is 1 or -1;
S204, the third matrix M3 is multiplied by the second matrix M2, obtains a 4th one-dimensional matrix M4, the described 4th
The line number of matrix M4 is d, and the value range of columns 1, each of described 4th matrix M4 element values is [- 255 × (a
× b) ,+255 × (a × b)] integer;
S205, the 4th matrix M4 is adjusted by activation primitive, and each element value displacement is reduced 2nTimes
Only retain integer-bit afterwards, n is variable element, and n belongs to integer, obtains a 6th one-dimensional matrix M6, the 6th matrix M6
Line number be d, the value range of columns 1, each of described 6th matrix M6 element values is
S206, a default two-dimensional 7th matrix M7, the line number of the 7th matrix M7 are c, columns d, binaryzation
Each of the 7th matrix M7 element values are -1 or+1;And a default two-dimensional 8th matrix M8, the described 8th
The line number of matrix M8 is c, the value range of columns d, each of described 8th matrix M8 element value be [- 1 ,+1] it
Between floating number;
S207, the 7th matrix M7 are multiplied by the 6th matrix M6, obtain a 9th one-dimensional matrix M9, and described
The line number of nine matrix M9 is c, and the value range of columns 1, each of described 9th matrix M9 element values isInteger, the member of every a line in the 9th matrix M9 described in the step S107
Element represents a kind of character, and the character representated by the element of every a line in the 9th matrix M9 is according to character sequence along row
Direction is arranged from top to bottom;Also, by the word representated by the row where numerical value greatest member value in the 9th matrix M9
Symbol is as prediction character;And
S208, judge whether the prediction character is equal to the character of presently described gray scale picture, if so, prediction character is accurate
Really, if it is not, then predicting character errors.
Preferably, the step S201 includes:Each element in first matrix respectively corresponds to the gray scale picture
In a pixel, it is [0,255] that the element value in corresponding first matrix of each pixel, which is value range,
Between integer.Preferably, the step S202 includes:To join end to end per a line in two-dimensional first matrix, it is one-dimensional to be formed
Second matrix, wherein the head end of the tail end linking next line of every a line of first matrix.
Preferably, the value range of d=a × b × e, e are the integers between [5,20].
Preferably, d=a × b × 10.
Preferably, the step S205 includes:According to any one activation the described 4th in following four activation primitive
Each element of matrix M4, the activation primitive include:
ReLU (x)=max (0, x);And STA (x)=max (0, | x |-α);
Then each element shift after activation is reduced 2nTimes, obtain a 5th one-dimensional matrix M5, the described 5th
The line number of matrix M5 is d, and the value range of columns 1, the element value in the 5th matrix M5 isBetween
Floating number;Wherein x represents each element value in the 4th matrix M4, and α is variable element, the value range of α be [0,
1];
Each element of the 5th matrix M5 is only retained into integer-bit, obtains the 6th matrix M6.
Preferably, the step S205 is replaced with reduces 2 by each element shift of the 4th matrix M4nIt is only protected after times
Integer-bit is stayed, obtains the 6th matrix M6, the line number of the 6th matrix M6 is d, columns 1, in the 6th matrix M6
Each of the value range of the element value be
Preferably, the step S206 includes:Each element value in the 7th matrix M7 and the 8th matrix M8
Initial assignment be 0.
The network learning method and training method suitable for gray scale picture of the present invention, overcomes the prior art
Difficulty, being used alternatingly by binaryzation matrix and floating-point matrix number, reduce byte number when matrix operation, accelerate fortune
Speed is calculated, the requirement to arithmetic facility is greatly reduced.
Description of the drawings
Technical scheme of the present invention is described in detail below in conjunction with the drawings and specific embodiments, so that the present invention
Characteristics and advantages become apparent.
Fig. 1 is the neural network schematic diagram of the present invention;
Fig. 2 be the present invention learning method in gray scale picture schematic diagram;
Fig. 3 is the flow chart of the network learning method suitable for gray scale picture of the present invention;
Fig. 4 be the present invention learning method in gray scale picture pretreated schematic diagram;
Fig. 5 be the present invention learning method in the first matrix M1 schematic diagram;
Fig. 6 be the present invention learning method in the second matrix M2 schematic diagram;
Fig. 7 be the present invention learning method in third matrix M3 schematic diagram;
Fig. 8 be the present invention learning method in the 4th matrix M4 schematic diagram;
Fig. 9 be the present invention learning method in the 5th matrix M5 schematic diagram;
Figure 10 be the present invention learning method in the 6th matrix M6 schematic diagram;
Figure 11 be the present invention learning method in the 7th matrix M7 schematic diagram;
Figure 12 be the present invention learning method in the 8th matrix M8 schematic diagram;
Figure 13 be the present invention learning method in the 9th matrix M9 schematic diagram;
Figure 14 be the present invention learning method in the tenth matrix M10 schematic diagram;
Figure 15 be the present invention learning method in the 11st matrix M11 schematic diagram;
Figure 16 be the present invention learning method in the 12nd matrix M12 schematic diagram;
Figure 17 be the present invention learning method in the 13rd matrix M13 schematic diagram;
Figure 18 be the present invention learning method in the 14th matrix M14 schematic diagram;
Figure 19 be the present invention learning method in the 15th matrix M15 schematic diagram;
Figure 20 be the present invention learning method in the 16th matrix M16 schematic diagram;And
Figure 21 is the flow chart of the neural network training method suitable for gray scale picture of the present invention.
Specific implementation mode
Detailed description will be provided to the embodiment of the present invention below.Although the present invention will combine some specific implementation modes
It is illustrated and illustrates, but should be noted that the present invention is not merely confined to these embodiments.On the contrary, to the present invention
The modification of progress or equivalent replacement, are intended to be within the scope of the claims of the invention.
In addition, in order to better illustrate the present invention, numerous details is given in specific implementation mode below.
It will be understood by those skilled in the art that without these details, the present invention can equally be implemented.It is right in other example
It is not described in detail in known structure and component, in order to highlight the purport of the present invention.
Fig. 1 is the neural network schematic diagram of the present invention, as shown in Figure 1, the neural network learning picture sample in the present invention.
Wherein, neural network can be divided into input layer 10, hidden layer 20 and output layer 30.Neural network is a kind of mimic biology nerve net
The computation model of network structure is made of a large amount of neuron by certain Topology connection, and each neuron represents an excitation
Function, the connection between neuron be known as weights (such as:A, B, C, D, E, F, G, H, I, J, K, L, M in Fig. 1, but not with this
It is limited).Input data enters from the input layer 10 of neural network, and result is exported from the output layer 30 of neural network.By to
The data known are trained, and change the weights of neural network, to make it have the result of prediction to unknown data.
The present embodiment learns largely (to be respectively provided with number with different Arabic numerals by allowing neural network
For " 0 ", " 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 " ten numbers) gray scale picture, to teach neural network
How this ten Arabic numerals are identified from picture.Specifically, gray scale picture signified in the present embodiment refers to using black
Tone indicates object, that is, use color on the basis of black, and the black of different saturation degrees shows image, wherein the ash of each pixel
The range of angle value is all by 0 to 255, and but not limited to this.The character of gray scale picture with " 0 " character pattern is 0, is carried
The character of the gray scale picture of " 1 " character pattern is 1, and the character of the gray scale picture with " 2 " character pattern is 2 ... with such
It pushes away.It is equivalent to and neuron is allowed to know which picture is the gray scale picture with " 0 ";Which picture is the gray scale picture with " 1 ";
Which picture is the gray scale picture ... etc. with " 2 ".
Neural network includes a large amount of neuron in the present invention, and a large amount of gray scale pictures with character graphics are provided respectively
Learnt to neuron, include c kind characters in gray scale picture, c belongs to constant, and the present invention initially sets up corresponding grey scale picture ruler
Very little neural network.Gray scale picture includes a rows, b row pixels, and neural network includes at least the input that a × b neuron is constituted
The hidden layer that the output layer and d neuron that layer, c neuron are constituted are constituted.Fig. 2 is gray scale in the learning method of the present invention
The schematic diagram of picture.Gray scale picture with character graphics represent arabic numeric characters, English alphabet character, Chinese character,
It is at least a kind of in Japanese character, Korea character, below by taking arabic numeric characters as an example, neural network of the invention carry out Ah
The study of Arabic numbers character.As shown in Fig. 2, being that 28 × 28 pixel carry " 2 " character pattern 150 with gray scale picture
Gray scale picture 100 for but not limited to this.(in other variations, gray scale picture can also be 24 × 24 pixels, 32
× 32 pixels, 40 × 40 pixels etc.) neural network all include input layer, one layer of hidden layer and output layer.Neural network
The dimension of input layer is that 784*1 (inputs, the matrix of corresponding 28*28) 28*28 with one-dimensional matrix form.Hidden layer in the present invention
Neuron number can be 10 times of input layer, such as:7840, but not limited to this.Output layer has 10 neurons, for knowing
Other 10 Arabic numerals judge that the specific number in the gray scale picture is which of 10 Arabic numerals.
Fig. 3 is the flow chart of the network learning method suitable for gray scale picture of the present invention.As shown in figure 3, this hair
The bright network learning method suitable for gray scale picture includes the following steps:
S101, Arabic numerals are represented by one " pretreatment of 2 " gray scale picture.Fig. 4 is ash in the learning method of the present invention
Spend the pretreated schematic diagram of picture.As shown in figure 4, according to pixel arrangement and character graphics in gray scale picture 100, wherein
The respective pixel in corresponding grey scale picture of each element in first matrix, if pixel belongs to character graphics and (belongs to
The point of Arabic numerals " 2 "), then the element value in corresponding first matrix of the pixel is higher (in such as dotted line inner region 160 absolutely
Most elements value is both greater than equal to 190, and but not limited to this).If pixel is not belonging to character graphics and (is not belonging to Arabic number
The point of word " 2 "), then the element value in corresponding first matrix of the pixel is relatively low, (such as outer region between solid box of dotted line
Most element values are less than 190 between 160, and but not limited to this).To which gray scale picture is converted into one two-dimensional first
Matrix M1.Fig. 5 be the present invention learning method in the first matrix M1 schematic diagram, as shown in figure 5, the line number of the first matrix M1 is
A, columns b, a, b are the constant more than 1, and the value range of each element value in the first matrix M1 is between [0,255]
Integer, [0,255] here is the gray value of the corresponding pixel.Since gray scale picture has 28 × 28 pixels, so
The line number of first matrix M1 is 28, columns 28.
S102, the first matrix is converted to a second one-dimensional matrix M2.Fig. 6 is in the learning method of the present invention second
The schematic diagram of matrix M2, as shown in fig. 6, the line number of the second matrix M2 is a × b=784, columns 1 is every in second matrix M2
Integer of the value range of a element value between [0,255].It will be first per a line in two-dimensional first matrix in the utility model
Tail is connected to form the second one-dimensional matrix, wherein the head end of the tail end linking next line of every a line of the first matrix, but not with this
It is limited.
S103, the random coded matrix of binaryzation is generated by same random seed to establish a two-dimensional third matrix
M3.Fig. 7 be the present invention learning method in third matrix M3 schematic diagram, as shown in fig. 7, the line number of third matrix M3 be d, d
Belong to the integer more than 0, columns is a × b=784, and each element value in third matrix M3 is 1 or -1.D=in the present invention
A × b × e, e are the integer more than 1.In a preferred embodiment, the value range of e is the integer between [5,20].This implementation
E=10, then d=a × b × 10=7840 in example.Then the line number of third matrix M3 is 7840, columns 784.
S104, third matrix M3 is multiplied by the second matrix M2, obtains a 4th one-dimensional matrix M4.Fig. 8 is the present invention
Learning method in the 4th matrix M4 schematic diagram, as shown in figure 8, the line number of the 4th matrix M4 is d=7840, columns 1, the
The value range of each element value in four matrix M4 is the integer of [- 255 × (a × b) ,+255 × (a × b)], i.e. value model
It encloses and is equal to [- 199920 ,+199920].
S105, the 4th matrix M4 is adjusted by activation primitive, and the displacement of each element value is reduced 2nOnly retain after times
Integer-bit, n are variable element, and n belongs to integer, obtain a 6th one-dimensional matrix M6, the line number of the 6th matrix M6 is d=
7840, the value range of columns 1, each element value in the 6th matrix M6 isBetween
Integer.Step S105 includes:Each element of the 4th matrix M4 is activated according to any one in following four activation primitive,
Activation primitive includes:
ReLU (x)=max (0, x).And
STA (x)=max (0, | x |-α).
Then each element shift after activation is reduced 2nTimes, obtain a 5th one-dimensional matrix M5.5th matrix
The line number of M5 is d=7840, and the value range of columns 1, the element value in the 5th matrix M5 isBetween
Floating number.Wherein x represents each element value in the 4th matrix M4, and α is variable element, and the value range of α is [0,1].It will
Each element of 5th matrix M5 only retains integer-bit, obtains the 6th matrix M6, but not limited to this.
In the present embodiment, the displacement of each element value is then reduced 2 by n=55Only retain integer-bit after times, and selects to use
STA (x)=max (0, | x |-α) activate the 4th matrix M4, α=0 to obtain the 5th matrix M5.Fig. 9 is the study side of the present invention
The schematic diagram of 5th matrix M5 in method, as shown in figure 9, the line number of the 5th matrix M5 is d=7840, columns 1.By the 5th matrix
Each element of M5 only retains integer-bit, obtains the 6th matrix M6.Figure 10 is the 6th matrix M6 in the learning method of the present invention
Schematic diagram, as shown in Figure 10, the line number of the 6th matrix M6 is d=7840, columns 1.The present invention can reduce 2 by shiftingn
Times, after the decimal point of element value is moved to right, then floating number is converted by activation primitive, it is last only to retain integer-bit, pass through this
Each element value in 4th matrix M4 is effectively reduced, and finally still remains integer-bit by a conversion process,
In order to which subsequent matrix multiplication calculates, byte number when matrix operation is reduced, accelerates arithmetic speed, is greatly reduced to fortune
Calculate the requirement of equipment.
In a preference, step S105 is replaced with reduces 2 by each element shift of the 4th matrix M4nIt is only protected after times
Integer-bit is stayed, obtains the 6th matrix M6, the line number of the 6th matrix M6 is d=7840, columns 1, each of the 6th matrix M6
The value range of element value is
S106, Figure 11 be the present invention learning method in the 7th matrix M7 schematic diagram.As shown in figure 11, a two dimension is established
The 7th matrix M7, the line number of the 7th matrix M7 is c=10, columns d=7840, each of the 7th matrix M7 of binaryzation
Element value is -1 or+1.And the schematic diagram of the 8th matrix M8 in the learning method that Figure 12 is the present invention.As shown in figure 12, it establishes
The line number of one two-dimensional 8th matrix M8, the 8th matrix M8 are c=10, each member in columns d=7840, the 8th matrix M8
The value range of plain value is the floating number between [- 1 ,+1].Each element value is initial in 7th matrix M7 and the 8th matrix M8
Assignment is 0.
S107, the 7th matrix M7 are multiplied by the 6th matrix M6, obtain a 9th one-dimensional matrix M9.Figure 13 is of the invention
The schematic diagram of 9th matrix M9 in learning method.As shown in figure 13, the line number of the 9th matrix M9 be c=10, columns 1, the 9th
The value range of each element value in matrix M9 isInteger, the step
The element of every a line in the 9th matrix M9 described in S107 represents a kind of character.Also, it is numerical value in the 9th matrix M9 is maximum
Character representated by row where element value is as prediction character.Wherein, due to the 7th matrix M7 be each element value be-
The value range of 1 or+1 binaryzation matrix, each element value in the 4th matrix M4 is the whole of [- 199920 ,+199920]
Number, the calculating process that the 7th matrix M7 is multiplied by the 6th matrix M6 is fairly simple, occupies that byte number is few, and operand is limited, obtains the
The calculating speed of nine matrix M9 is quickly.
S108, obtain representing current gray level picture character the tenth one-dimensional matrix M10, the line number of the tenth matrix M10
For c=10, the element of columns 1, every a line in the tenth matrix M10 represents a kind of character, is represented in the tenth matrix M10 current
The element value of the row of the character of gray scale picture is 0 or 2m, m is variable element, and m belongs to integer, and the element value of remaining row is 0.Step
Character representated by the element of every a line in the tenth matrix M10 in rapid the 9th matrix M9 of S107 and in step S108 according to
Identical character sequence is arranged from top to bottom along column direction, such as:All it is first in 9th matrix M9 and the tenth matrix M10
Row represents Arabic numerals " 0 ";Second row represents Arabic numerals " 1 ";The third line represents Arabic numerals " 2 ";Fourth line generation
Table Arabic numerals " 3 ";Fifth line represents Arabic numerals " 4 ";6th row represents Arabic numerals " 5 ";7th row represent Ah
Arabic numbers " 6 ";8th row represents Arabic numerals " 7 ";9th row represents Arabic numerals " 8 ";Tenth row represents Arab
Digital " 9 ".Also, in the present embodiment, m=7, Figure 14 be the present invention learning method in the tenth matrix M10 schematic diagram.Such as figure
Shown in 14, because first numerical value of the fourth line of the tenth matrix M10 is 27=128, first numerical value of remaining row is all 0, so currently
The character of gray scale picture be Arabic numerals " 2 " (only have the third line to have digital " 128 " in Figure 14, often row is all " 0 " for remaining,
The third line represents Arabic numerals " 2 ").
S109, the tenth matrix M10 is subtracted into the 9th matrix M9, obtains the 11st one-dimensional matrix of an expression error
M11.Figure 15 be the present invention learning method in the 11st matrix M11 schematic diagram.As shown in figure 15, the 11st matrix M11
Line number is c=10, and the value range of each element value in the 1, the 11st matrix M11 of columns isBetween integer.
S110, the transposed matrix for calculating the 6th matrix M6, obtain a 12nd one-dimensional matrix M12.Figure 16 is this hair
The schematic diagram of 12nd matrix M12 in bright learning method.As shown in figure 16, the line number of the 12nd matrix M12 is 1, columns d
The value range of element value in=7840, the 12nd matrix M12 isBetween floating number.
S111, it the 6th matrix M6 is multiplied by the 12nd matrix M12 obtains a procedure parameter num, procedure parameter num belongs to whole
Number.In the present embodiment, procedure parameter num=M12*M6=101269224461.000.
S112, the 12nd matrix M12 divided by procedure parameter num are obtained to a 13rd one-dimensional matrix M13.Figure 17 is
The schematic diagram of 13rd matrix M13 in the learning method of the present invention.As shown in figure 17, the line number of the 13rd matrix M13 is 1, row
Number is d=7840, and the value range of the element value in the 13rd matrix M13 isBetween it is floating
Points.In a preference, step S112 could alternatively be:By the procedure parameter num after the 12nd matrix M12 divided by adjustment
Obtaining a 13rd one-dimensional matrix M13, the method for process parameters num is to add 1 summation to procedure parameter num, the tenth
The line number of three matrix M13 is 1, and the value range of the element value in columns d=7840, the 13rd matrix M13 isBetween floating number, the step of procedure parameter num adds 1 summation procedure parameter in order to prevent
Num can not be calculated subsequently equal to 0.
S113, the 11st matrix M11 is multiplied by the 13rd matrix M13, obtains a two-dimensional 14th matrix M14.Figure
18 for the present invention learning method in the 14th matrix M14 schematic diagram.As shown in figure 18, the line number of the 14th matrix M14 is c
=10, the value range of the element value in columns d=7840, the 14th matrix M14 isBetween floating number.
S114, the 14th matrix M14 is added with the 8th matrix M8, obtains a 15th matrix M15, Figure 19 is this hair
The schematic diagram of 15th matrix M15 in bright learning method.As shown in figure 19, the 8th current matrix M8 is updated to the 15th
The line number of matrix M15, the 15th matrix M15 are c=10, and the element value in columns d=7840, the 15th matrix M15 takes
Value is ranging fromBetween floating number.
S115, the 15th matrix M15 is subjected to binaryzation, the element value that 0 is more than in the 15th matrix M15 is converted into 1,
The element value for being less than or equal to 0 in 15th matrix M15 is converted into -1, obtains a 16th matrix M16.Figure 20 is the present invention
Learning method in the 16th matrix M16 schematic diagram.As shown in figure 20, the line number of the 16th matrix M16 is c=10, columns
For d=7840, the element value in the 16th matrix M16 is -1 or 1.The 7th current matrix M7 is updated to the 16th matrix
M16, so far completes primary learning process, return to step S107, by continuous circulation step S107 to step S115, the 7th
Matrix M7 and the 8th matrix M8 can be thus continually updated so that increasingly be connect by the 7th matrix M7 the 9th matrix M9 being calculated
Arabic numerals representated by nearly current gray level picture " 2 ".Start all the presence of two-dimensional 7th matrix M7 always in step S106
(binaryzation " 1 " and " -1 ") and two-dimensional 8th matrix M8 (floating number), and subsequently in calculating, the 7th matrix M7 is only used only
Product is carried out, and the 8th matrix M8 (floating number) will not carry out directly carrying out multiplication or add operation, the 15th matrix M15
(floating number) is used only for being converted into the 7th new matrix M7 by binaryzation.So as to avoid the matrix with a large amount of floating numbers
The operation of big data quantity for being multiplied and generating reduces matrix fortune by being used alternatingly for binaryzation matrix and floating-point matrix number
Byte number when calculation accelerates arithmetic speed, greatly reduces the requirement to arithmetic facility.
Relatively, in the method if being not provided with corresponding binaryzation matrix (the 7th matrix M7) and floating-point matrix number
(the 8th matrix M8) will carry out the matrix multiple with a large amount of floating numbers and the fortune of big data quantity that generates in step s 107
It calculates, considerably increases byte number when matrix operation, slowed down arithmetic speed.
On the basis of the network learning method suitable for gray scale picture of the present invention, carry out calculating deformation or meter
The technical solution of the adjustment of calculation sequence is also fallen within the scope and spirit of the invention.
Figure 21 is the flow chart of the neural network training method suitable for gray scale picture of the present invention.As shown in figure 21, originally
The neural network training method suitable for gray scale picture of invention includes the following steps:
S201, the gray scale picture pretreatment that Arabic numerals " 2 " are represented one.Fig. 4 is ash in the learning method of the present invention
Spend the pretreated schematic diagram of picture.As shown in figure 4, according to pixel arrangement and character graphics in gray scale picture 100, wherein
The respective pixel in corresponding grey scale picture of each element in first matrix, if pixel belongs to character graphics and (belongs to
The point of Arabic numerals " 2 "), then the element value in corresponding first matrix of the pixel is higher (in such as dotted line inner region 160 absolutely
Most elements value is both greater than equal to 190, and but not limited to this).If pixel is not belonging to character graphics and (is not belonging to Arabic number
The point of word " 2 "), then the element value in corresponding first matrix of the pixel is relatively low, (such as outer region between solid box of dotted line
Most element values are less than 190 between 160, and but not limited to this).To which gray scale picture is converted into one two-dimensional first
Matrix M1.Fig. 5 be the present invention learning method in the first matrix M1 schematic diagram, as shown in figure 5, the line number of the first matrix M1 is
A, columns b, a, b are the constant more than 1, and the value range of each element value in the first matrix M1 is between [0,255]
Integer.Since gray scale picture has 28 × 28 pixels, so the line number of the first matrix M1 is 28, columns 28.
S202, the first matrix is converted to a second one-dimensional matrix M2.Fig. 6 is in the learning method of the present invention second
The schematic diagram of matrix M2, as shown in fig. 6, the line number of the second matrix M2 is a × b=784, columns 1 is every in second matrix M2
Integer of the value range of a element value between [0,255].It will be first per a line in two-dimensional first matrix in the utility model
Tail is connected to form the second one-dimensional matrix, wherein the head end of the tail end linking next line of every a line of the first matrix, but not with this
It is limited.
S203, the random coded matrix of binaryzation is generated by same random seed to establish a two-dimensional third matrix
M3.Fig. 7 be the present invention learning method in third matrix M3 schematic diagram, as shown in fig. 7, the line number of third matrix M3 be d=
7840, d belong to the integer more than 0, and columns is a × b=784, and each element value in third matrix M3 is 1 or -1.The present invention
In d=a × b × e, e is integer more than 1.In a preferred embodiment, the value range of e is the integer between [5,20].
E=10 in the present embodiment, then d=a × b × 10=7840.Then the line number of third matrix M3 is 7840, columns 784.
S204, third matrix M3 is multiplied by the second matrix M2, obtains a 4th one-dimensional matrix M4.Fig. 8 is the present invention
Learning method in the 4th matrix M4 schematic diagram, as shown in figure 8, the line number of the 4th matrix M4 is d=7840, columns 1, the
The value range of each element value in four matrix M4 is the integer of [- 255 × (a × b) ,+255 × (a × b)], i.e. value model
It encloses and is equal to [- 199920 ,+199920].
S205, the 4th matrix M4 is adjusted by activation primitive, and the displacement of each element value is reduced 2nOnly retain after times
Integer-bit, n are variable element, and n belongs to integer, obtain a 6th one-dimensional matrix M6, the line number of the 6th matrix M6 is d=
7840, the value range of columns 1, each element value in the 6th matrix M6 isBetween
Integer.Step S205 includes:Each element of the 4th matrix M4 is activated according to any one in following four activation primitive,
Activation primitive includes:
ReLU (x)=max (0, x).And
STA (x)=max (0, | x |-α).
Then each element shift after activation is reduced 2nTimes, obtain a 5th one-dimensional matrix M5.5th matrix
The line number of M5 is d=7840, and the value range of columns 1, the element value in the 5th matrix M5 isBetween
Floating number.Wherein x represents each element value in the 4th matrix M4, and α is variable element, and the value range of α is [0,1].By
Each element of five matrix M5 only retains integer-bit, obtains the 6th matrix M6, but not limited to this.
In the present embodiment, the displacement of each element value is then reduced 2 by n=55Only retain integer-bit after times, and selects to use
STA (x)=max (0, | x |-α) activate the 4th matrix M4, α=0 to obtain the 5th matrix M5.Fig. 9 is the study side of the present invention
The schematic diagram of 5th matrix M5 in method, as shown in figure 9, the line number of the 5th matrix M5 is d=7840, columns 1.By the 5th matrix
Each element of M5 only retains integer-bit, obtains the 6th matrix M6.Figure 10 is the 6th matrix M6 in the learning method of the present invention
Schematic diagram, as shown in Figure 10, the line number of the 6th matrix M6 is d=7840, columns 1.The present invention can reduce 2 by shiftingn
Times, after the decimal point of element value is moved to right, then floating number is converted by activation primitive, it is last only to retain integer-bit, pass through this
Each element value in 4th matrix M4 is effectively reduced, and finally still remains integer-bit by a conversion process,
In order to which subsequent matrix multiplication calculates, byte number when matrix operation is reduced, accelerates arithmetic speed, is greatly reduced to fortune
Calculate the requirement of equipment.
In a preference, step S205 is replaced with reduces 2 by each element shift of the 4th matrix M4nIt is only protected after times
Integer-bit is stayed, obtains the 6th matrix M6, the line number of the 6th matrix M6 is d=7840, columns 1, each of the 6th matrix M6
The value range of element value is
S206, Figure 11 be the present invention learning method in the 7th matrix M7 schematic diagram.As shown in figure 11, a two dimension is established
The 7th matrix M7, the line number of the 7th matrix M7 is c=10, columns d=7840, each of the 7th matrix M7 of binaryzation
Element value is -1 or+1.And the schematic diagram of the 8th matrix M8 in the learning method that Figure 12 is the present invention.As shown in figure 12, it establishes
The line number of one two-dimensional 8th matrix M8, the 8th matrix M8 are c=10, each member in columns d=7840, the 8th matrix M8
The value range of plain value is the floating number between [- 1 ,+1].Each element value is initial in 7th matrix M7 and the 8th matrix M8
Assignment is 0.
S207, the 7th matrix M7 are multiplied by the 6th matrix M6, obtain a 9th one-dimensional matrix M9.Figure 13 is of the invention
The schematic diagram of 9th matrix M9 in learning method.As shown in figure 13, the line number of the 9th matrix M9 be c=10, columns 1, the 9th
The value range of each element value in matrix M9 isInteger, the step
The element of every a line in the 9th matrix M9 described in S107 represents a kind of character, the member of every a line in the 9th matrix M9
The character representated by element is arranged according to character sequence along column direction from top to bottom.Also, by number in the 9th matrix M9
The character representated by row where value greatest member value is as prediction character.The first row in the 9th matrix M9 in step S207
Represent Arabic numerals " 0 ";Second row represents Arabic numerals " 1 ";The third line represents Arabic numerals " 2 ";Fourth line represents
Arabic numerals " 3 ";Fifth line represents Arabic numerals " 4 ";6th row represents Arabic numerals " 5 ";7th row represents me
Uncle is digital " 6 ";8th row represents Arabic numerals " 7 ";9th row represents Arabic numerals " 8 ";Tenth row represents Arabic number
Word " 9 ".Wherein, since the 7th matrix M7 is the binaryzation matrix that each element value is -1 or+1, in the 4th matrix M4
The value range of each element value is the integer of [- 199920 ,+199920], and the 7th matrix M7 is multiplied by the calculating of the 6th matrix M6
Process is fairly simple, and occupancy byte number is few, and operand is limited, obtains the calculating speed of the 9th matrix M9 quickly.
S208, judge to predict the character whether character is equal to current gray level picture, if so, prediction character is accurate, if it is not,
Then predict character errors.In the present embodiment, the third line institute in the 9th matrix M9 where numerical value greatest member value " 42044135 "
The character " 2 " of representative then predicts that character is accurate as prediction character.
The neural network training method suitable for gray scale picture of the present invention is the Neural Network Science suitable for gray scale picture
The distributed process of learning method can carry out the verification of algorithm, without with new using current 7th matrix M7
7th matrix M7 and the 8th matrix M8.The neural network training method suitable for gray scale picture of the present invention can be independent of this
The network learning method suitable for gray scale picture of invention and independently carry out, in the god suitable for gray scale picture of the invention
On the basis of network training method, calculate the technical solution of deformation or the adjustment of computation sequence also and fallen in the present invention
Protection domain within.
In summary, the network learning method and training method suitable for gray scale picture of the invention, overcomes
The difficulty of the prior art, being used alternatingly by binaryzation matrix and floating-point matrix number, reduce word when matrix operation
Joint number accelerates arithmetic speed, greatly reduces the requirement to arithmetic facility.
The specific application example that the above is only the present invention, is not limited in any way protection scope of the present invention.Except above-mentioned
Outside embodiment, the present invention can also have other embodiment.All technical solutions formed using equivalent substitution or equivalent transformation,
It falls within scope of the present invention.
Claims (20)
1. a kind of network learning method suitable for gray scale picture, which is characterized in that the neural network includes a large amount of
A large amount of gray scale pictures with character graphics are respectively supplied to the neuron and learnt by neuron, the gray scale picture
In include c kind characters, c belongs to constant, includes the following steps:
S101, a gray scale picture is pre-processed, according to the pixel arrangement and character graphics in the gray scale picture, by the gray scale
Picture is converted into a two-dimensional first matrix M1, and the line number of the first matrix M1 is a, and columns b, a, b are more than 1
Constant, the integer of the value range of each element value in the first matrix M1 between [0,255];
S102, the line number for converting first matrix to second one-dimensional matrix a M2, the second matrix M2 are a × b,
Columns is 1, the integer of the value range of each element value in the second matrix M2 between [0,255];
S103, a two-dimensional third matrix M3 is established by the random coded matrix of same random seed generation binaryzation,
The line number of the third matrix M3 is d, and d belongs to the integer more than 0, and columns is a × b, each member in the third matrix M3
Element value is 1 or -1;
S104, the third matrix M3 is multiplied by the second matrix M2, obtains a 4th one-dimensional matrix M4, the 4th matrix
The line number of M4 is d, columns 1, the value range of each element value in the 4th matrix M4 be [- 255 × (a × b) ,+
255 × (a × b)] integer;
S105, the 4th matrix M4 is adjusted by activation primitive, and the displacement of each element value is reduced 2nOnly retain after times whole
Numerical digit, n are variable element, and n belongs to integer, obtain a 6th one-dimensional matrix M6, and the line number of the 6th matrix M6 is d,
Columns is 1, and the value range of each element value in the 6th matrix M6 isBetween
Integer;
S106, establish a two-dimensional 7th matrix M7, the line number of the 7th matrix M7 is c, columns d, binaryzation it is described
Each element value in 7th matrix M7 is -1 or+1;And a two-dimensional 8th matrix M8 is established, the 8th matrix M8's
Line number is c, and the value range of each element value in columns d, the 8th matrix M8 is the floating number between [- 1 ,+1];
S107, the 7th matrix M7 are multiplied by the 6th matrix M6, obtain a 9th one-dimensional matrix M9, the 9th square
The line number of battle array M9 is c, and the value range of columns 1, each element value in the 9th matrix M9 isInteger, the member of every a line in the 9th matrix M9 described in the step S107
Element represents a kind of character;Also, using the character representated by the row where numerical value greatest member value in the 9th matrix M9 as
Predict character;
S108, the tenth one-dimensional matrix M10, the tenth matrix M10 are obtained according to the character for representing presently described gray scale picture
Line number be c, columns 1, the element for presetting every a line in the tenth matrix M10 represents a kind of character, described the
The element value that a line of the character of presently described gray scale picture is represented in ten matrix M10 is 2m, m is variable element, and m belongs to whole
It counts, the element value of remaining row is 0 in the tenth matrix M10;
S109, the tenth matrix M10 is subtracted into the 9th matrix M9, obtains the 11st one-dimensional square of an expression error
Battle array M11, the line number of the 11st matrix M11 are c, columns 1, and each element value in the 11st matrix M11 takes
Value range isBetween integer;
S110, the transposed matrix for calculating the 6th matrix M6, obtain a 12nd one-dimensional matrix M12, and the described 12nd
The line number of matrix M12 is 1, and the value range of the element value in columns d, the 12nd matrix M12 isBetween floating number;
S111, it the 6th matrix M6 is multiplied by the 12nd matrix M12 obtains a procedure parameter num, the procedure parameter
Num belongs to integer;
S112, the 12nd matrix M12 divided by the procedure parameter num are obtained into a 13rd one-dimensional matrix M13, institute
The line number for stating the 13rd matrix M13 is 1, and the value range of the element value in columns d, the 13rd matrix M13 isBetween floating number;
S113, the 11st matrix M11 is multiplied by the 13rd matrix M13, obtains two-dimensional 14th matrix
The line number of M14, the 14th matrix M14 are c, the value range of the element value in columns d, the 14th matrix M14
ForBetween floating number;
S114, the 14th matrix M14 is added with the 8th matrix M8, obtains a 15th matrix M15, it will be current
The 8th matrix M8 be updated to the 15th matrix M15, the line number of the 15th matrix M15 is c, columns d, institute
The value range for stating the element value in the 15th matrix M15 isBetween floating number;And
S115, the 15th matrix M15 is subjected to binaryzation, the element value that 0 is more than in the 15th matrix M15 is converted
It is 1, the element value that 0 is less than or equal in the 15th matrix M15 is converted into -1, obtains a 16th matrix M16, it is described
The line number of 16th matrix M16 is c, and the element value in columns d, the 16th matrix M16 is -1 or 1;By current institute
It states the 7th matrix M7 and is updated to the 16th matrix M16, return to step S107.
2. being suitable for the network learning method of gray scale picture as described in claim 1, which is characterized in that the step
S101 includes:Each element in first matrix respectively corresponds to a pixel in the gray scale picture, each described
Element value in corresponding first matrix of pixel is integer of the value range between [0,255].
3. being suitable for the network learning method of gray scale picture as described in claim 1, which is characterized in that the step
S102 includes:It will join end to end to form the second one-dimensional matrix per a line in two-dimensional first matrix, wherein first matrix
Every a line tail end linking next line head end.
4. being suitable for the network learning method of gray scale picture as described in claim 1, which is characterized in that d=a × b ×
E, e are the integer more than 1.
5. being suitable for the network learning method of gray scale picture as claimed in claim 4, which is characterized in that the value model of e
It is integer between [5,20] to enclose.
6. being suitable for the network learning method of gray scale picture as described in claim 1, which is characterized in that the step
S105 includes:Each element of the 4th matrix M4 is activated according to any one in following four activation primitive, it is described
Activation primitive includes:
ReLU (x)=max (0, x);And
STA (x)=max (0, | x |-α);
Then each element shift after activation is reduced 2nTimes, obtain a 5th one-dimensional matrix M5, the 5th matrix M5
Line number be d, the value range of columns 1, the element value in the 5th matrix M5 isBetween floating-point
Number;Wherein x represents each element value in the 4th matrix M4, and α is variable element, and the value range of α is [0,1];
Each element of the 5th matrix M5 is only retained into integer-bit, obtains the 6th matrix M6.
7. being suitable for the network learning method of gray scale picture as described in claim 1, which is characterized in that the step
S105 is replaced with reduces 2 by each element shift of the 4th matrix M4nOnly retain integer-bit after times, obtains the 6th square
The line number of battle array M6, the 6th matrix M6 are d, columns 1, the value model of each of described 6th matrix M6 element values
Enclosing is
8. being suitable for the network learning method of gray scale picture as described in claim 1, which is characterized in that the step
S106 includes:The initial assignment of each element value is 0 in the 7th matrix M7 and the 8th matrix M8.
9. being suitable for the network learning method of gray scale picture as described in claim 1, which is characterized in that the step
It is described representated by the element of every a line in the tenth matrix M10 in the 9th matrix M9 and the step S108 described in S107
Character is arranged according to identical character sequence along column direction from top to bottom.
10. being suitable for the network learning method of gray scale picture as described in claim 1, which is characterized in that the step
S112 is replaced with:The procedure parameter num after the 12nd matrix M12 divided by adjustment is obtained into one-dimensional the 13
Matrix M13, the method for adjusting the procedure parameter num are to add 1 summation, the 13rd matrix M13 to the procedure parameter num
Line number be 1, the value range of the element value in columns d, the 13rd matrix M13 isBetween floating number.
11. being suitable for the network learning method of gray scale picture as described in claim 1, which is characterized in that described to carry
The gray scale picture of character graphics represents arabic numeric characters, English alphabet character, Chinese character, Japanese character, Korea character
In it is at least a kind of.
12. being suitable for the network learning method of gray scale picture as described in claim 1, which is characterized in that the gray scale
Picture includes a rows, b row pixels, and the neural network includes at least input layer, the c neuron structure that a × b neuron is constituted
At output layer and d neuron constitute hidden layer.
13. a kind of neural network training method suitable for gray scale picture, which is characterized in that the neural network includes a large amount of
A large amount of gray scale pictures with character graphics are respectively supplied to the neuron and learnt by neuron, the gray scale picture
In include c kind characters, c belongs to constant, includes the following steps:
S201, a gray scale picture is pre-processed, according to the pixel arrangement and character graphics in the gray scale picture, by the gray scale
Picture is converted into a two-dimensional first matrix M1, and the line number of the first matrix M1 is a, and columns b, a, b are more than 1
Constant, the integer of the value range of each element value in the first matrix M1 between [0,255];
S202, the line number for converting first matrix to second one-dimensional matrix a M2, the second matrix M2 are a × b,
Columns is 1, the integer of the value range of each element value in the second matrix M2 between [0,255];
S203, a two-dimensional third matrix M3 is established by the random coded matrix of same random seed generation binaryzation,
The line number of the third matrix M3 is d, and d belongs to the integer more than 0, and columns is a × b, each member in the third matrix M3
Element value is 1 or -1;
S204, the third matrix M3 is multiplied by the second matrix M2, obtains a 4th one-dimensional matrix M4, the 4th matrix
The line number of M4 is d, columns 1, the value range of each element value in the 4th matrix M4 be [- 255 × (a × b) ,+
255 × (a × b)] integer;
S205, the 4th matrix M4 is adjusted by activation primitive, and the displacement of each element value is reduced 2nOnly retain after times whole
Numerical digit, n are variable element, and n belongs to integer, obtain a 6th one-dimensional matrix M6, and the line number of the 6th matrix M6 is d,
Columns is 1, and the value range of each element value in the 6th matrix M6 is
S206, a default two-dimensional 7th matrix M7, the line number of the 7th matrix M7 are c, columns d, binaryzation it is described
Each element value in 7th matrix M7 is -1 or+1;And a default two-dimensional 8th matrix M8, the 8th matrix M8's
Line number is c, and the value range of each element value in columns d, the 8th matrix M8 is the floating number between [- 1 ,+1];
S207, the 7th matrix M7 are multiplied by the 6th matrix M6, obtain a 9th one-dimensional matrix M9, the 9th square
The line number of battle array M9 is c, and the value range of columns 1, each element value in the 9th matrix M9 isInteger, the member of every a line in the 9th matrix M9 described in the step S107
Element represents a kind of character, and the character representated by the element of every a line in the 9th matrix M9 is according to character sequence along row
Direction is arranged from top to bottom;Also, by the word representated by the row where numerical value greatest member value in the 9th matrix M9
Symbol is as prediction character;And
S208, judge whether the prediction character is equal to the character of presently described gray scale picture, if so, prediction character is accurate,
If it is not, then predicting character errors.
14. being suitable for the neural network training method of gray scale picture as claimed in claim 13, which is characterized in that the step
S201 includes:Each element in first matrix respectively corresponds to a pixel in the gray scale picture, each described
Element value in corresponding first matrix of pixel is integer of the value range between [0,255].
15. being suitable for the neural network training method of gray scale picture as claimed in claim 13, which is characterized in that the step
S202 includes:It will join end to end to form the second one-dimensional matrix per a line in two-dimensional first matrix, wherein first matrix
Every a line tail end linking next line head end.
16. being suitable for the neural network training method of gray scale picture as claimed in claim 13, which is characterized in that d=a × b
The value range of × e, e are the integers between [5,20].
17. being suitable for the neural network training method of gray scale picture as claimed in claim 16, which is characterized in that d=a × b
×10。
18. being suitable for the neural network training method of gray scale picture as claimed in claim 13, which is characterized in that the step
S205 includes:Each element of the 4th matrix M4 is activated according to any one in following four activation primitive, it is described
Activation primitive includes:
ReLU (x)=max (0, x);And STA (x)=max (0, | x |-α);
Then each element shift after activation is reduced 2nTimes, obtain a 5th one-dimensional matrix M5, the 5th matrix M5
Line number be d, the value range of columns 1, the element value in the 5th matrix M5 isBetween floating-point
Number;Wherein x represents each element value in the 4th matrix M4, and α is variable element, and the value range of α is [0,1];
Each element of the 5th matrix M5 is only retained into integer-bit, obtains the 6th matrix M6.
19. being suitable for the neural network training method of gray scale picture as claimed in claim 13, which is characterized in that the step
S205 is replaced with reduces 2 by each element shift of the 4th matrix M4nOnly retain integer-bit after times, obtains the 6th square
The line number of battle array M6, the 6th matrix M6 are d, columns 1, the value model of each of described 6th matrix M6 element values
Enclosing is
20. being suitable for the neural network training method of gray scale picture as claimed in claim 13, which is characterized in that the step
S206 includes:The initial assignment of each element value is 0 in the 7th matrix M7 and the 8th matrix M8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611010902.9A CN107038451B (en) | 2016-11-17 | 2016-11-17 | Network learning method and training method suitable for gray scale picture |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611010902.9A CN107038451B (en) | 2016-11-17 | 2016-11-17 | Network learning method and training method suitable for gray scale picture |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107038451A CN107038451A (en) | 2017-08-11 |
CN107038451B true CN107038451B (en) | 2018-09-21 |
Family
ID=59531134
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611010902.9A Active CN107038451B (en) | 2016-11-17 | 2016-11-17 | Network learning method and training method suitable for gray scale picture |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107038451B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111242847B (en) * | 2020-01-10 | 2021-03-30 | 上海西井信息科技有限公司 | Gateway-based image splicing method, system, equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8406522B1 (en) * | 2009-08-17 | 2013-03-26 | Hrl Laboratories, Llc | Method for flexible feature recognition in visual systems incorporating evolutionary optimization |
CN103295019A (en) * | 2013-05-21 | 2013-09-11 | 西安理工大学 | Self-adaptive Chinese fragment restoration method based on probability statistics |
CN104636309A (en) * | 2015-02-06 | 2015-05-20 | 南京理工大学 | Matrix calculator based on machine vision and matrix identification method |
CN105184226A (en) * | 2015-08-11 | 2015-12-23 | 北京新晨阳光科技有限公司 | Digital identification method, digital identification device, neural network training method and neural network training device |
CN105184265A (en) * | 2015-09-14 | 2015-12-23 | 哈尔滨工业大学 | Self-learning-based handwritten form numeric character string rapid recognition method |
-
2016
- 2016-11-17 CN CN201611010902.9A patent/CN107038451B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8406522B1 (en) * | 2009-08-17 | 2013-03-26 | Hrl Laboratories, Llc | Method for flexible feature recognition in visual systems incorporating evolutionary optimization |
CN103295019A (en) * | 2013-05-21 | 2013-09-11 | 西安理工大学 | Self-adaptive Chinese fragment restoration method based on probability statistics |
CN104636309A (en) * | 2015-02-06 | 2015-05-20 | 南京理工大学 | Matrix calculator based on machine vision and matrix identification method |
CN105184226A (en) * | 2015-08-11 | 2015-12-23 | 北京新晨阳光科技有限公司 | Digital identification method, digital identification device, neural network training method and neural network training device |
CN105184265A (en) * | 2015-09-14 | 2015-12-23 | 哈尔滨工业大学 | Self-learning-based handwritten form numeric character string rapid recognition method |
Also Published As
Publication number | Publication date |
---|---|
CN107038451A (en) | 2017-08-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109858623B (en) | Apparatus and method for performing artificial neural network forward operations | |
WO2017185412A1 (en) | Neural network operation device and method supporting few-bit fixed-point number | |
CN109766469B (en) | Image retrieval method based on deep hash learning optimization | |
CN107886167A (en) | Neural network computing device and method | |
CN111259666A (en) | CNN text classification method combined with multi-head self-attention mechanism | |
CN112073221A (en) | Method and device for realizing network node sequencing | |
CN112508190A (en) | Method, device and equipment for processing structured sparse parameters and storage medium | |
CN117648846B (en) | Image sample generation method for composite material performance prediction modeling | |
CN107038451B (en) | Network learning method and training method suitable for gray scale picture | |
CN113168310A (en) | Hardware module for converting numbers | |
CN113343025B (en) | Sparse attack resisting method based on weighted gradient Hash activation thermodynamic diagram | |
CN109670582B (en) | Design method of full-fixed-point neural network | |
CN107944471A (en) | A kind of ORB characteristic point matching methods based on Nonlinear Scale Space Theory | |
CN113628101B (en) | Three-stage tile image generation method based on GAN network structure | |
CN106980869B (en) | Network learning method and training method suitable for black and white picture | |
CN111639523B (en) | Target detection method, device, computer equipment and storage medium | |
CN111652359B (en) | Multiplier array for matrix operations and multiplier array for convolution operations | |
CN107885854A (en) | A kind of semi-supervised cross-media retrieval method of feature based selection and virtual data generation | |
CN110688722B (en) | Automatic generation method of part attribute matrix based on deep learning | |
CN112418070A (en) | Attitude estimation method based on decoupling ladder network | |
US11531896B2 (en) | Neural network circuit providing for operations with bit shifting and rounded values of weight information | |
CN115859011B (en) | Matrix operation method, device, unit and electronic equipment | |
Davvaz et al. | Mathematical prediction of Ying’s twin universes | |
CN107220702B (en) | Computer vision processing method and device of low-computing-capacity processing equipment | |
Singh et al. | A new approach to superfractals |
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 | ||
CP01 | Change in the name or title of a patent holder | ||
CP01 | Change in the name or title of a patent holder |
Address after: Room 503-3, 398 Jiangsu Road, Changning District, Shanghai 200050 Patentee after: Shanghai Xijing Technology Co.,Ltd. Address before: Room 503-3, 398 Jiangsu Road, Changning District, Shanghai 200050 Patentee before: SHANGHAI WESTWELL INFORMATION AND TECHNOLOGY Co.,Ltd. |