CN107038451A - Suitable for the network learning method and training method of gray scale picture - Google Patents
Suitable for the network learning method and training method of gray scale picture Download PDFInfo
- Publication number
- CN107038451A CN107038451A CN201611010902.9A CN201611010902A CN107038451A CN 107038451 A CN107038451 A CN 107038451A CN 201611010902 A CN201611010902 A CN 201611010902A CN 107038451 A CN107038451 A CN 107038451A
- Authority
- CN
- China
- Prior art keywords
- matrix
- gray scale
- element 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.)
- Granted
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 invention provides the network learning method and training method suitable for gray scale picture, including:The pretreatment of gray scale picture is the second matrix;The random coded matrix of binaryzation is generated, the second matrix is then multiplied by for the 4th matrix;Activation primitive is adjusted to the 6th matrix;Set up the 7th matrix of binaryzation and the 8th matrix of floating number;7th Matrix Multiplication is using the 4th matrix as the 9th matrix;To represent the tenth matrix of character;Tenth matrix is subtracted into the 9th matrix for the 11st matrix;It regard 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 using the 13rd matrix as the 14th matrix;14th matrix is added with the 8th matrix and obtains the 15th matrix, the 8th new matrix is used as;It regard the 15th matrix binaryzation as the 7th new matrix;The present invention reduces byte number during matrix operation, accelerates arithmetic speed, reduces hsrdware requirements.
Description
Technical field
The present invention relates to field of neural networks, network learning method and the training of gray scale picture are especially adapted for use in
Method.
Background technology
With the continuous evolution of computer and information technology, machine learning and pattern-recognition turn into most processed in recent years
Hand can heat one of field.Gradually substituted in some image recognition tasks for needing people to perform in the past by machine, such as car
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,
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 many due to being related in existing network learning method
The computing of position floating number, universal amount of calculation is excessive, has slowed down arithmetic speed, so the requirement to arithmetic facility is very high.
The content of the invention
It is an object of the invention to provide the network learning method and training method suitable for gray scale picture, overcome
The difficulty of 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 there is provided the network learning method suitable for gray scale picture, the nerve net
Network includes substantial amounts of neuron, and a large amount of gray scale pictures with character graphics are respectively supplied into the neuron is learnt,
C kind characters are included in the gray scale picture, c belongs to constant, comprised the following steps:
S101, a gray scale picture pre-processed, pixel arrangement and character graphics in the gray scale picture will be described
The line number that gray scale picture is converted into first two-dimentional matrix a M1, the first matrix M1 is a, and columns is b, and a, b are big
The span of each element value in 1 constant, the first matrix M1 is the integer between [0,255];
S102, the line number that first matrix is converted into second one-dimensional matrix a M2, the second matrix M2 are a
× b, columns is 1, and the span of each element value in the second matrix M2 is the integer between [0,255];
S103, the random coded matrix for generating binaryzation by same random seed set up a 3rd two-dimentional matrix
M3, the 3rd matrix M3 line number are d, and d belongs to the integer more than 0, and columns is each in a × b, the 3rd matrix M3
The element value is 1 or -1;
S104, the 3rd matrix M3 is multiplied by the second matrix M2, obtains a 4th one-dimensional matrix M4, the described 4th
Matrix M4 line number is d, and columns is 1, and the span of each element value in the 4th matrix M4 is [- 255 × (a
× b) ,+255 × (a × b)] integer;
S105, adjust the 4th matrix M4 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, obtain a 6th one-dimensional matrix M6, the 6th matrix M6
Line number be d, columns is 1, and the span of each element value in the 6th matrix M6 isIt
Between integer;
S106, the 7th matrix M7 for setting up a two dimension, the line number of the 7th matrix M7 is c, and columns is d, binaryzation
Each element value in the 7th matrix M7 is -1 or+1;And set up the 8th matrix M8 of a two dimension, the described 8th
Matrix M8 line number is c, and columns is d, the span of each element value in the 8th matrix M8 be [- 1 ,+1] it
Between floating number;
S107, the 7th matrix M7 are multiplied by the 4th matrix M4, obtain a 9th one-dimensional matrix M9, described
Nine matrix M9 line number is c, and columns is 1, and the span of each element value in the 9th matrix M9 isInteger, the member of every a line described in the step S107 in the 9th matrix M9
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, obtain representing presently described gray scale picture character the tenth one-dimensional matrix M10, the tenth matrix
M10 line number is c, and columns is 1, and the element of every a line in the tenth matrix M10 represents a kind of character, the described tenth
The element value that the row of the character of presently described gray scale picture is represented in matrix M10 is 0 or 2m, m is variable element, and m belongs to integer,
The element value of remaining row is 0;
S109, the tenth matrix M10 subtracted into the 9th matrix M9, obtain one-dimensional the tenth of an expression error
One matrix M11, the 11st matrix M11 line number is c, and columns is 1, each member in the 11st matrix M11
The span 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
12 matrix M12 line number is 1, and columns is d, and the span of the element value in the 12nd matrix M12 isBetween floating number;
S111, 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 obtained into a 13rd one-dimensional matrix
M13, the 13rd matrix M13 line number are 1, and columns is d, the span of the element value in the 13rd matrix M13
ForBetween floating number;
S113, the 11st matrix M11 is multiplied by the 13rd matrix M13, obtains a 14th two-dimentional square
Battle array M14, the 14th matrix M14 line number are c, and columns is d, the value model of the element value in 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, 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 span of element value in d, the 15th matrix M15 is
Between floating number;And
S115, by the 15th matrix M15 carry out binaryzation, will in the 15th matrix M15 be more than 0 element value
1 is converted into, the element value that 0 is less than or equal in the 15th matrix M15 is converted into -1, a 16th matrix M16 is obtained,
The line number of the 16th matrix M16 is c, and columns is d, and the element value in the 16th matrix M16 is -1 or 1;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 each corresponds to the gray scale picture
In a pixel, the element value in corresponding first matrix of each pixel is that span is [0,255]
Between integer.
Preferably, the step S102 includes:It will join end to end to form one-dimensional the per a line in first matrix of two dimension
Two matrixes, wherein the tail end of every a line of first matrix is connected the head end of next line.
Preferably, d=a × b × e, e are the integer more than 1.
Preferably, e span is the integer between [5,20].
Preferably, the step S105 includes:Any one activation the described 4th in following four activation primitive
Matrix M4 each element, the 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 described 5th
Matrix M5 line number is d, and columns is 1, and the span of 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, α span for [0,
1];
Each element of the 5th matrix M5 is only retained into integer-bit, the 6th matrix M6 is obtained.
Preferably, the step S105 is replaced with reduces 2 by each element shift of the 4th matrix M4nOnly protected after times
Integer-bit is stayed, the 6th matrix M6 is obtained, the line number of the 6th matrix M6 is d, and columns is 1, in the 6th matrix M6
The span of each 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 described in the step S107 in the 9th matrix M9 and the step S108
The character representated by element per a line is arranged from top to bottom according to identical character sequence along column direction.
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, adjusts the method for the procedure parameter num to add the procedure parameter num
1 summation, the line number of the 13rd matrix M13 is 1, and columns is d, the value model of the element value in the 13rd matrix M13
Enclose forBetween floating number.
Preferably, the gray scale picture with character graphics represents arabic numeric characters, English alphabet character, Chinese
An at least class in character, Japanese character, Korea character.
Preferably, the gray scale picture includes a rows, b row pixels, and the neutral net at least includes a × b neuron structure
Into input layer, the output layer that c neuron is constituted and d neuron composition hidden layer.
According to another aspect of the present invention there is provided the neural network training method suitable for gray scale picture, the nerve
Network includes substantial amounts of neuron, and a large amount of gray scale pictures with character graphics are respectively supplied into the neuron
Practise, c kind characters are included in the gray scale picture, c belongs to constant, comprised the following steps:
S201, a gray scale picture pre-processed, pixel arrangement and character graphics in the gray scale picture will be described
The line number that gray scale picture is converted into first two-dimentional matrix a M1, the first matrix M1 is a, and columns is b, and a, b are big
The span of each element value in 1 constant, the first matrix M1 is the integer between [0,255];
S202, the line number that first matrix is converted into second one-dimensional matrix a M2, the second matrix M2 are a
× b, columns is 1, and the span of each element value in the second matrix M2 is the integer between [0,255];
S203, the random coded matrix for generating binaryzation by same random seed set up a 3rd two-dimentional matrix
M3, the 3rd matrix M3 line number are d, and d belongs to the integer more than 0, and columns is each in a × b, the 3rd matrix M3
The element value is 1 or -1;
S204, the 3rd matrix M3 is multiplied by the second matrix M2, obtains a 4th one-dimensional matrix M4, the described 4th
Matrix M4 line number is d, and columns is 1, and the span of each element value in the 4th matrix M4 is [- 255 × (a
× b) ,+255 × (a × b)] integer;
S205, adjust the 4th matrix M4 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, obtain a 6th one-dimensional matrix M6, the 6th matrix M6
Line number be d, columns is 1, and the span of each element value in the 6th matrix M6 is
S206, a default two dimension the 7th matrix M7, the line number of the 7th matrix M7 is c, and columns is d, binaryzation
Each element value in the 7th matrix M7 is -1 or+1;And the 8th matrix M8 of a default two dimension, the described 8th
Matrix M8 line number is c, and columns is d, the span of each element value in the 8th matrix M8 be [- 1 ,+1] it
Between floating number;
S207, the 7th matrix M7 are multiplied by the 4th matrix M4, obtain a 9th one-dimensional matrix M9, described
Nine matrix M9 line number is c, and columns is 1, and the span of each element value in the 9th matrix M9 isInteger, the member of every a line described in the step S107 in the 9th matrix M9
The character that element represents representated by a kind of element of every a line in character, the 9th matrix M9 is arranged according to character sequence edge
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 used as prediction character;And
S208, judge whether the prediction character is equal to the character of presently described gray scale picture, if so, then prediction character is accurate
Really, if it is not, then predicting character errors.
Preferably, the step S201 includes:Each element in first matrix each corresponds to the gray scale picture
In a pixel, the element value in corresponding first matrix of each pixel is that span is [0,255]
Between integer.Preferably, the step S202 includes:It will join end to end to form one-dimensional per a line in the first matrix of two dimension
Second matrix, wherein the tail end of every a line of first matrix is connected the head end of next line.
Preferably, d=a × b × e, e span is the integer between [5,20].
Preferably, d=a × b × 10.
Preferably, the step S205 includes:Any one activation the described 4th in following four activation primitive
Matrix M4 each element, the 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 described 5th
Matrix M5 line number is d, and columns is 1, and the span of 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, α span for [0,
1];
Each element of the 5th matrix M5 is only retained into integer-bit, the 6th matrix M6 is obtained.
Preferably, the step S205 is replaced with reduces 2 by each element shift of the 4th matrix M4nOnly protected after times
Integer-bit is stayed, the 6th matrix M6 is obtained, the line number of the 6th matrix M6 is d, and columns is 1, in the 6th matrix M6
The span of each 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 prior art
Difficulty, being used alternatingly by binaryzation matrix and floating-point matrix number, reduce byte number during matrix operation, accelerate fortune
Speed is calculated, the requirement to arithmetic facility is greatly reduced.
Brief description of the drawings
Technical scheme is described in detail below in conjunction with the drawings and specific embodiments, so that the present invention
Characteristic and advantage become apparent.
Fig. 1 is neutral net schematic diagram of the invention;
Fig. 2 is the schematic diagram of gray scale picture in learning method of the invention;
Fig. 3 is the flow chart of the network learning method suitable for gray scale picture of the present invention;
Fig. 4 is the schematic diagram of the pretreatment of gray scale picture in learning method of the invention;
The schematic diagram that Fig. 5 is the first matrix M1 in learning method of the invention;
The schematic diagram that Fig. 6 is the second matrix M2 in learning method of the invention;
The schematic diagram that Fig. 7 is the 3rd matrix M3 in learning method of the invention;
The schematic diagram that Fig. 8 is the 4th matrix M4 in learning method of the invention;
The schematic diagram that Fig. 9 is the 5th matrix M5 in learning method of the invention;
The schematic diagram that Figure 10 is the 6th matrix M6 in learning method of the invention;
The schematic diagram that Figure 11 is the 7th matrix M7 in learning method of the invention;
The schematic diagram that Figure 12 is the 8th matrix M8 in learning method of the invention;
The schematic diagram that Figure 13 is the 9th matrix M9 in learning method of the invention;
The schematic diagram that Figure 14 is the tenth matrix M10 in learning method of the invention;
The schematic diagram that Figure 15 is the 11st matrix M11 in learning method of the invention;
The schematic diagram that Figure 16 is the 12nd matrix M12 in learning method of the invention;
The schematic diagram that Figure 17 is the 13rd matrix M13 in learning method of the invention;
The schematic diagram that Figure 18 is the 14th matrix M14 in learning method of the invention;
The schematic diagram that Figure 19 is the 15th matrix M15 in learning method of the invention;
The schematic diagram that Figure 20 is the 16th matrix M16 in learning method of the invention;And
Figure 21 is the flow chart of the neural network training method suitable for gray scale picture of the present invention.
Embodiment
To embodiments of the invention be provided with detailed description below.Although the present invention will combine some embodiments
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 substitution, all should cover among scope of the presently claimed invention.
In addition, in order to better illustrate the present invention, numerous details are given in embodiment 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 part, in order to highlight the purport of the present invention.
Fig. 1 is neutral net schematic diagram of the invention, as shown in figure 1, the neural network learning picture sample in the present invention.
Wherein, neutral net can be divided into input layer 10, hidden layer 20 and output layer 30.Neutral net is a kind of mimic biology nerve net
The computation model of network structure, is made up of substantial amounts of neuron by certain Topology connection, and each neuron represents an excitation
Connection between function, neuron is referred to as weights (for example: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 neutral net, from the output result of output layer 30 of neutral net.By to
The data known are trained, and change the weights of neutral net, so that it has the result of prediction to unknown data.
The present embodiment learns largely (to be respectively provided with numeral with different Arabic numerals by allowing neutral net
Exemplified by " 0 ", " 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 " ten numerals) gray scale picture, to teach neutral net
How this ten Arabic numerals are recognized from picture.Specifically, gray scale picture signified in the present embodiment refers to using black
Tone represents object, i.e., with color on the basis of black, and the black of different saturation degrees carrys out display image, wherein the ash of each pixel
The scope of angle value is all, by 0 to 255, but to be not limited.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
Push away.Equivalent to allowing neuron to know, which picture is the gray scale picture with " 0 ";Which picture is the gray scale picture with " 1 ";
Which picture is gray scale picture ... with " 2 " etc..
Neutral net includes substantial amounts of neuron in the present invention, and a large amount of gray scale pictures with character graphics are provided respectively
Learnt to neuron, c kind characters are included in gray scale picture, c belongs to constant, and the present invention initially sets up corresponding grey scale picture chi
Very little neutral net.Gray scale picture includes a rows, b row pixels, and neutral net at least includes 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,
An at least class in Japanese character, Korea character, below by taking arabic numeric characters as an example, neutral net 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 exemplified by but be not limited.(in other variations, gray scale picture can also be 24 × 24 pixels, 32
× 32 pixels, 40 × 40 pixels etc.) neutral net all includes input layer, one layer of hidden layer and output layer.Neutral net
The dimension of input layer is that 784*1 (inputs, correspondence 28*28 matrix) 28*28 with one-dimensional matrix form.Hidden layer in the present invention
Neuron number can be 10 times of input layer, for example:7840, but be not limited.Output layer has 10 neurons, for knowing
Other 10 Arabic numerals, which in 10 Arabic numerals judges the specific numeral in the gray scale picture is.
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 comprises the following steps:
S101, by one represent Arabic numerals " 2 " gray scale picture pretreatment.Fig. 4 is ash in the learning method of the present invention
Spend the schematic diagram of the pretreatment of picture.As shown in figure 4, pixel arrangement and character graphics in gray scale picture 100, wherein,
The pixel of each element in first matrix each in corresponding grey scale picture, if pixel belongs to character graphics and (belonged 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, but is not limited).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, but are not limited).So as to which gray scale picture is converted into two-dimentional first
Matrix M1.The schematic diagram that Fig. 5 is the first matrix M1 in learning method of the invention, as shown in figure 5, the first matrix M1 line number is
A, columns is b, and the span that a, b are each element value in the constant more than 1, the first matrix M1 is between [0,255]
Integer, [0,255] here be to should pixel gray value.Because gray scale picture has 28 × 28 pixels, so
First matrix M1 line number is 28, and columns is 28.
S102, the first matrix is converted into a second one-dimensional matrix M2.Fig. 6 is in the learning method of the present invention second
Matrix M2 schematic diagram, as shown in fig. 6, the second matrix M2 line number is a × b=784, columns is 1, every in the second matrix M2
The span of individual element value is the integer between [0,255].By every a line head and the tail phase in the first matrix of two dimension in the present invention
Company forms the second one-dimensional matrix, wherein the tail end of every a line of the first matrix is connected the head end of next line, but is not limited.
S103, the random coded matrix for generating binaryzation by same random seed set up a 3rd two-dimentional matrix
M3.The schematic diagram that Fig. 7 is the 3rd matrix M3 in learning method of the invention, as shown in fig. 7, the 3rd matrix M3 line number is d, d
Belong to the integer more than 0, columns is that each element value in a × b=784, the 3rd matrix M3 is 1 or -1.D=in the present invention
A × b × e, e are the integer more than 1.In a preferred scheme, e span is the integer between [5,20].This implementation
E=10, then d=a × b × 10=7840 in example.Then the 3rd matrix M3 line number is 7840, and columns is 784.
S104, the 3rd 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 4th matrix M4 line number is d=7840, columns is 1, the
The span of each element value in four matrix M4 is the integer of [- 255 × (a × b) ,+255 × (a × b)], i.e. value model
Enclose equal to [- 199920 ,+199920].
S105, by activation primitive adjust the 4th matrix M4, and by each element value displacement reduce 2nOnly retain after times
Integer-bit, n is variable element, and n belongs to integer, obtains a 6th one-dimensional matrix M6, the 6th matrix M6 line number is d=
7840, columns is 1, and the span of each element value in the 6th matrix M6 isBetween integer.Step
Rapid S105 includes:Each element of the 4th matrix M4 of any one activation in following four activation primitive, activates letter
Number 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
M5 line number is d=7840, and columns is 1, and the span of 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 α span is [0,1].Will
5th matrix M5 each element only retains integer-bit, obtains the 6th matrix M6, but be not limited.
In the present embodiment, the displacement of each element value is then reduced 2 by n=55Only retain integer-bit after times, and select to use
STA (x)=max (0, | x |-α) activate the 4th matrix M4, α=0 obtains the 5th matrix M5.Fig. 9 is study side of the invention
5th matrix M5 schematic diagram in method, as shown in figure 9, the 5th matrix M5 line number is d=7840, columns is 1.By the 5th matrix
M5 each element 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 6th matrix M6 line number is d=7840, and columns is 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 into by activation primitive, it is last only to retain integer-bit, by this
Individual conversion process, each element value in the 4th matrix M4 is effectively reduced, and finally still remains integer-bit,
In order to which follow-up matrix multiplication is calculated, byte number during 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 the 4th matrix M4 each element shiftnOnly protected after times
Integer-bit is stayed, the 6th matrix M6 is obtained, the 6th matrix M6 line number is d=7840, and columns is 1, each in the 6th matrix M6
The span of element value is
The schematic diagram that S106, Figure 11 are the 7th matrix M7 in learning method of the invention.As shown in figure 11, a two dimension is set up
The 7th matrix M7, the 7th matrix M7 line number is c=10, and columns is each in d=7840, the 7th matrix M7 of binaryzation
Element value is -1 or+1.And Figure 12 is the schematic diagram of the 8th matrix M8 in the learning method of the present invention.As shown in figure 12, set up
8th matrix M8 of one two dimension, the 8th matrix M8 line number are c=10, and columns is each member in d=7840, the 8th matrix M8
The span 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 4th matrix M4, obtain a 9th one-dimensional matrix M9.Figure 13 is of the invention
9th matrix M9 schematic diagram in learning method.As shown in figure 13, the 9th matrix M9 line number is c=10, and columns is the 1, the 9th
The span of each element value in matrix M9 isInteger, the step
The element of every a line described in S107 in the 9th matrix M9 represents a kind of character.Also, numerical value in the 9th matrix M9 is maximum
The character representated by row where element value is used as prediction character.Wherein, due to the 7th matrix M7 be each element value be-
The span of each element value in 1 or+1 binaryzation matrix, the 4th matrix M4 is whole for [- 199920 ,+199920]
Number, the calculating process that the 7th matrix M7 is multiplied by the 4th matrix M4 is fairly simple, takes that byte number is few, and operand is limited, obtains the
Nine matrix M9 calculating speed is quickly.
S108, obtain representing current gray level picture character the tenth one-dimensional matrix M10, the tenth matrix M10 line number
For c=10, columns is 1, and the element of every a line in the tenth matrix M10, which is represented in a kind of character, the tenth matrix M10, to be represented currently
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 rapid matrix M9 of S107 the 9th and in the tenth matrix M10 in step S108 according to
Identical character sequence is arranged from top to bottom along column direction, for example: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, the schematic diagram that Figure 14 is the tenth matrix M10 in learning method of the invention.As schemed
Shown in 14, because first numerical value of the tenth matrix M10 fourth line 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, remaining often row be all " 0 ",
The third line represents Arabic numerals " 2 ").
S109, the tenth matrix M10 subtracted into the 9th matrix M9, obtain the 11st one-dimensional matrix M11 of an expression error.
The schematic diagram that Figure 15 is the 11st matrix M11 in learning method of the invention.As shown in figure 15, the 11st matrix M11 line number is c
=10, columns is that the span of each element value in the 1, the 11st matrix M11 isIt
Between integer.
S110, the transposed matrix for calculating the 6th matrix M6, obtain a 12nd one-dimensional matrix M12.Figure 16 is this hair
12nd matrix M12 schematic diagram in bright learning method.As shown in figure 16, the 12nd matrix M12 line number is 1, and columns is d
The span of element value in=7840, the 12nd matrix M12 isBetween floating number.
S111, 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
13rd matrix M13 schematic diagram in the learning method of the present invention.As shown in figure 17, the 13rd matrix M13 line number is 1, row
Number is d=7840, and the span of the element value in the 13rd matrix M13 isBetween floating number.One
In individual preference, step S112 could alternatively be:Procedure parameter num after 12nd matrix M12 divided by adjustment is obtained one
The 13rd one-dimensional matrix M13, process parameters num method are to add 1 summation, the 13rd matrix M13 to procedure parameter num
Line number be 1, columns is that the span of the element value in d=7840, the 13rd matrix M13 isBetween
Floating number, the step of procedure parameter num adds 1 summation in order to prevent procedure parameter num be equal to 0 and can not subsequently be calculated.
S113, the 11st matrix M11 is multiplied by the 13rd matrix M13, obtains a 14th two-dimentional matrix M14.Figure 18 is
14th matrix M14 schematic diagram in the learning method of the present invention.As shown in figure 18, the 14th matrix M14 line number is c=10, columns
For d=7840, the span of the element value in the 14th matrix M14 is
Between floating number.
S114, the 14th matrix M14 is added with the 8th matrix M8, obtains a 15th matrix M15, Figure 19 is this hair
15th matrix M15 schematic diagram in bright learning method.As shown in figure 19, the 8th current matrix M8 is updated to the 15th
Matrix M15, the 15th matrix M15 line number are c=10, and columns is taking for the element value in d=7840, the 15th matrix M15
Value scope isBetween floating number.
S115, by the 15th matrix M15 carry out binaryzation, by the 15th matrix M15 be more than 0 element value be converted into 1,
The element value for being less than or equal to 0 in 15th matrix M15 is converted into -1, a 16th matrix M16 is obtained.Figure 20 is the present invention
Learning method in the 16th matrix M16 schematic diagram.As shown in figure 20, the 16th matrix M16 line number 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 learning process once, and return to step S107 passes through continuous circulation step S107 to step S115, the 7th
Matrix M7 and the 8th matrix M8 can be thus continually updated so that calculated the 9th obtained matrix M9 by the 7th matrix M7 and increasingly connect
Arabic numerals representated by nearly current gray level picture " 2 ".Start the 7th matrix M7 that all there is two dimension all the time in step S106
(binaryzation " 1 " and " -1 ") and the 8th matrix M8 (floating number) of two dimension, and subsequently in calculating, only using only the 7th matrix M7
To carry out product, 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 computing for the big data quantity for being multiplied and producing, by being used alternatingly for binaryzation matrix and floating-point matrix number, reduces matrix fortune
Byte number during calculation, accelerates arithmetic speed, greatly reduces the requirement to arithmetic facility.
Relatively, if being not provided with corresponding binaryzation matrix (the 7th matrix M7) and floating-point matrix number in the method
(the 8th matrix M8), the fortune for the big data quantity that the matrix multiple with a large amount of floating numbers will be carried out in step s 107 and is produced
Calculate, considerably increase byte number during 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 scheme of the adjustment of calculation order 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 comprises the following steps:
S201, the gray scale picture pretreatment for representing one Arabic numerals " 2 ".Fig. 4 is ash in the learning method of the present invention
Spend the schematic diagram of the pretreatment of picture.As shown in figure 4, pixel arrangement and character graphics in gray scale picture 100, wherein,
The pixel of each element in first matrix each in corresponding grey scale picture, if pixel belongs to character graphics and (belonged 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, but is not limited).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, but are not limited).So as to which gray scale picture is converted into two-dimentional first
Matrix M1.The schematic diagram that Fig. 5 is the first matrix M1 in learning method of the invention, as shown in figure 5, the first matrix M1 line number is
A, columns is b, and the span that a, b are each element value in the constant more than 1, the first matrix M1 is between [0,255]
Integer.Because gray scale picture has 28 × 28 pixels, so the first matrix M1 line number is 28, columns is 28.
S202, the first matrix is converted into a second one-dimensional matrix M2.Fig. 6 is in the learning method of the present invention second
Matrix M2 schematic diagram, as shown in fig. 6, the second matrix M2 line number is a × b=784, columns is 1, every in the second matrix M2
The span of individual element value is the integer between [0,255].By every a line head and the tail phase in the first matrix of two dimension in the present invention
Company forms the second one-dimensional matrix, wherein the tail end of every a line of the first matrix is connected the head end of next line, but is not limited.
S203, the random coded matrix for generating binaryzation by same random seed set up a 3rd two-dimentional matrix
M3.The schematic diagram that Fig. 7 is the 3rd matrix M3 in learning method of the invention, as shown in fig. 7, the 3rd matrix M3 line number is d=
7840, d belong to the integer more than 0, and columns is that each element value in a × b=784, the 3rd matrix M3 is 1 or -1.The present invention
In d=a × b × e, e is integer more than 1.In a preferred scheme, e span is the integer between [5,20].
E=10 in the present embodiment, then d=a × b × 10=7840.Then the 3rd matrix M3 line number is 7840, and columns is 784.
S204, the 3rd 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 4th matrix M4 line number is d=7840, columns is 1, the
The span of each element value in four matrix M4 is the integer of [- 255 × (a × b) ,+255 × (a × b)], i.e. value model
Enclose equal to [- 199920 ,+199920].
S205, by activation primitive adjust the 4th matrix M4, and by each element value displacement reduce 2nOnly retain after times
Integer-bit, n is variable element, and n belongs to integer, obtains a 6th one-dimensional matrix M6, the 6th matrix M6 line number is d=
7840, columns is 1, and the span of each element value in the 6th matrix M6 isBetween integer.Step
S205 includes:Each element of the 4th matrix M4 of any one activation in following four activation primitive, activation primitive
Including:
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
M5 line number is d=7840, and columns is 1, and the span of 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 α span is [0,1].By
Five matrix M5 each element only retains integer-bit, obtains the 6th matrix M6, but be not limited.
In the present embodiment, the displacement of each element value is then reduced 2 by n=55Only retain integer-bit after times, and select to use
STA (x)=max (0, | x |-α) activate the 4th matrix M4, α=0 obtains the 5th matrix M5.Fig. 9 is study side of the invention
5th matrix M5 schematic diagram in method, as shown in figure 9, the 5th matrix M5 line number is d=7840, columns is 1.By the 5th matrix
M5 each element 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 6th matrix M6 line number is d=7840, and columns is 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 into by activation primitive, it is last only to retain integer-bit, by this
Individual conversion process, each element value in the 4th matrix M4 is effectively reduced, and finally still remains integer-bit,
In order to which follow-up matrix multiplication is calculated, byte number during 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 the 4th matrix M4 each element shiftnOnly protected after times
Integer-bit is stayed, the 6th matrix M6 is obtained, the 6th matrix M6 line number is d=7840, and columns is 1, each in the 6th matrix M6
The span of element value is
The schematic diagram that S206, Figure 11 are the 7th matrix M7 in learning method of the invention.As shown in figure 11, a two dimension is set up
The 7th matrix M7, the 7th matrix M7 line number is c=10, and columns is each in d=7840, the 7th matrix M7 of binaryzation
Element value is -1 or+1.And Figure 12 is the schematic diagram of the 8th matrix M8 in the learning method of the present invention.As shown in figure 12, set up
8th matrix M8 of one two dimension, the 8th matrix M8 line number are c=10, and columns is each member in d=7840, the 8th matrix M8
The span 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 4th matrix M4, obtain a 9th one-dimensional matrix M9.Figure 13 is of the invention
9th matrix M9 schematic diagram in learning method.As shown in figure 13, the 9th matrix M9 line number is c=10, and columns is the 1, the 9th
The span of each element value in matrix M9 isInteger, the step
The element of every a line described in S107 in the 9th matrix M9 represents a kind of member of every a line in character, the 9th matrix M9
The character representated by element is arranged from top to bottom according to character sequence along column direction.Also, by number in the 9th matrix M9
The character representated by row where value greatest member value is used 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 is represented
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, due to the 7th matrix M7 be each element value be -1 or+1 binaryzation matrix, in the 4th matrix M4
The span of each element value is the integer of [- 199920 ,+199920], and the 7th matrix M7 is multiplied by the 4th matrix M4 calculating
Process is fairly simple, and occupancy byte number is few, and operand is limited, obtains the 9th matrix M9 calculating speed quickly.
S208, judge to predict the character whether character is equal to current gray level picture, if so, then 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 applies to the Neural Network Science of gray scale picture
The distributed process of learning method, can carry out the checking of algorithm, without with new in the case of 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 scheme 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 prior art, being used alternatingly by binaryzation matrix and floating-point matrix number, reduce word during matrix operation
Joint number, accelerates arithmetic speed, greatly reduces the requirement to arithmetic facility.
It the above is only the concrete application example of the present invention, protection scope of the present invention be not limited in any way.Except above-mentioned
Implement exception, the present invention there can also be other embodiment.All use equivalent substitutions or the technical scheme of equivalent transformation formation,
Fall within scope of the present invention.
Claims (20)
1. a kind of network learning method suitable for gray scale picture, it is characterised in that the neutral net includes substantial amounts 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, comprises the following steps:
S101, by a gray scale picture pre-process, pixel arrangement and character graphics in the gray scale picture, by the gray scale
The line number that picture is converted into first two-dimentional matrix a M1, the first matrix M1 is a, and columns is b, and a, b are more than 1
The span of each element value in constant, the first matrix M1 is the integer between [0,255];
S102, the line number that first matrix is converted into second one-dimensional matrix a M2, the second matrix M2 are a × b,
Columns is 1, and the span of each element value in the second matrix M2 is the integer between [0,255];
S103, the random coded matrix for generating binaryzation by same random seed set up a 3rd two-dimentional matrix M3,
The line number of the 3rd matrix M3 is d, and d belongs to the integer more than 0, and columns is each institute in a × b, the 3rd matrix M3
It is 1 or -1 to state element value;
S104, the 3rd matrix M3 is multiplied by the second matrix M2, obtains a 4th one-dimensional matrix M4, the 4th matrix
M4 line number is d, and columns is 1, the span of each element value in the 4th matrix M4 for [- 255 × (a ×
B) ,+255 × (a × b)] integer;
S105, adjust the 4th matrix M4 by activation primitive, and each element value displacement is reduced 2nOnly protected after times
Integer-bit is stayed, n is variable element, and n belongs to integer, obtain a 6th one-dimensional matrix M6, the line number of the 6th matrix M6
For d, columns is 1, and the span of each element value in the 6th matrix M6 isBetween it is whole
Number;
S106, the 7th matrix M7 for setting up a two dimension, the line number of the 7th matrix M7 is c, and columns is d, binaryzation it is described
Each element value in 7th matrix M7 is -1 or+1;And set up the 8th matrix M8 of a two dimension, the 8th matrix
M8 line number is c, and columns is d, and the span of each element value in the 8th matrix M8 is between [- 1 ,+1]
Floating number;
S107, the 7th matrix M7 are multiplied by the 4th matrix M4, obtain a 9th one-dimensional matrix M9, the 9th square
Battle array M9 line number is c, and columns is 1, and the span of each element value in the 9th matrix M9 isInteger, the member of every a line described in the step S107 in the 9th matrix M9
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, obtain representing presently described gray scale picture character the tenth one-dimensional matrix M10, the tenth matrix M10's
Line number is c, and columns is 1, and the element of every a line in the tenth matrix M10 represents a kind of character, the tenth matrix
The element value that the row of the character of presently described gray scale picture is represented in M10 is 0 or 2m, m is variable element, and m belongs to integer, remaining
Capable element value is 0;
S109, the tenth matrix M10 subtracted into the 9th matrix M9, obtain the 11st one-dimensional square of an expression error
Battle array M11, the 11st matrix M11 line number are c, and columns is 1, each element value in the 11st matrix M11
Span beBetween integer;
S110, the transposed matrix for calculating the 6th matrix M6, obtain a 12nd one-dimensional matrix M12, the described 12nd
Matrix M12 line number is 1, and columns is d, and the span of the element value in the 12nd matrix M12 is
Between floating number;
S111, 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 obtained into a 13rd one-dimensional matrix M13, institute
The line number for stating the 13rd matrix M13 is 1, and columns is d, and the span of the element value in the 13rd matrix M13 isBetween floating number;
S113, the 11st matrix M11 is multiplied by the 13rd matrix M13, obtains a 14th two-dimentional matrix
M14, the 14th matrix M14 line number are c, and columns is d, the span of the element value in the 14th matrix M14
ForBetween floating number;
S114, the 14th matrix M14 is added with the 8th matrix M8, obtains a 15th matrix M15, will be current
The 8th matrix M8 be updated to the 15th matrix M15, the line number of the 15th matrix M15 is c, and columns is d, institute
The span for stating the element value in the 15th matrix M15 is
Between floating number;And
S115, by the 15th matrix M15 carry out binaryzation, by the 15th matrix M15 be more than 0 element value convert
For 1, the element value that 0 is less than or equal in the 15th matrix M15 is converted into -1, a 16th matrix M16 is obtained, it is described
16th matrix M16 line number is c, and columns is d, and the element value in the 16th matrix M16 is -1 or 1;By current institute
State the 7th matrix M7 and be updated to the 16th matrix M16, return to step S107.
2. it is applied to the network learning method of gray scale picture as claimed in claim 1, it is characterised in that the step
S101 includes:Each element in first matrix each corresponds to a pixel in the gray scale picture, each described
Element value in corresponding first matrix of pixel is that span is the integer between [0,255].
3. it is applied to the network learning method of gray scale picture as claimed in claim 1, it is characterised in that the step
S102 includes:It will join end to end to form the second one-dimensional matrix per a line in the first matrix of two dimension, wherein first matrix
Every a line tail end be connected next line head end.
4. it is applied to the network learning method of gray scale picture as claimed in claim 1, it is characterised in that d=a × b ×
E, e are the integer more than 1.
5. it is applied to the network learning method of gray scale picture as claimed in claim 4, it is characterised in that e value model
It is integer between [5,20] to enclose.
6. it is applied to the network learning method of gray scale picture as claimed in claim 1, it is characterised in that the step
S105 includes:Each element of any one activation the 4th matrix M4 in following four activation primitive, it is described
Activation primitive includes:
2
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, columns is 1, and the span of the element value in the 5th matrix M5 isBetween it is floating
Points;Wherein x represents each element value in the 4th matrix M4, and α is variable element, and α span is [0,1];
Each element of the 5th matrix M5 is only retained into integer-bit, the 6th matrix M6 is obtained.
7. it is applied to the network learning method of gray scale picture as claimed in claim 1, it is characterised in that the step
S105 is replaced with reduces 2 by each element shift of the 4th matrix M4nOnly retain integer-bit after times, obtain the 6th square
Battle array M6, the 6th matrix M6 line number are d, and columns is 1, the value model of each element value in the 6th matrix M6
Enclosing is
8. it is applied to the network learning method of gray scale picture as claimed in claim 1, it is characterised 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. it is applied to the network learning method of gray scale picture as claimed in claim 1, it is characterised in that the step
It is described representated by the element of every a line in the tenth matrix M10 described in S107 in the 9th matrix M9 and the step S108
Character is arranged from top to bottom according to identical character sequence along column direction.
10. it is applied to the network learning method of gray scale picture as claimed in claim 1, it is characterised 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, adjusts the method for the procedure parameter num to add the procedure parameter num 1 summation, the 13rd matrix M13
Line number be 1, columns is d, and the span of the element value in the 13rd matrix M13 isBetween
Floating number.
11. it is applied to the network learning method of gray scale picture as claimed in claim 1, it is characterised 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 an at least class.
12. it is applied to the network learning method of gray scale picture as claimed in claim 1, it is characterised in that the gray scale
Picture includes a rows, b row pixels, and the neutral net at least includes input layer, the c neuron structure that a × b neuron is constituted
Into the hidden layer that constitutes of output layer and d neuron.
13. a kind of neural network training method suitable for gray scale picture, it is characterised in that the neutral net includes substantial amounts 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, comprises the following steps:
S201, by a gray scale picture pre-process, pixel arrangement and character graphics in the gray scale picture, by the gray scale
The line number that picture is converted into first two-dimentional matrix a M1, the first matrix M1 is a, and columns is b, and a, b are more than 1
The span of each element value in constant, the first matrix M1 is the integer between [0,255];
S202, the line number that first matrix is converted into second one-dimensional matrix a M2, the second matrix M2 are a × b,
Columns is 1, and the span of each element value in the second matrix M2 is the integer between [0,255];
S203, the random coded matrix for generating binaryzation by same random seed set up a 3rd two-dimentional matrix M3,
The line number of the 3rd matrix M3 is d, and d belongs to the integer more than 0, and columns is each institute in a × b, the 3rd matrix M3
It is 1 or -1 to state element value;
S204, the 3rd matrix M3 is multiplied by the second matrix M2, obtains a 4th one-dimensional matrix M4, the 4th matrix
M4 line number is d, and columns is 1, the span of each element value in the 4th matrix M4 for [- 255 × (a ×
B) ,+255 × (a × b)] integer;
S205, adjust the 4th matrix M4 by activation primitive, and each element value displacement is reduced 2nOnly protected after times
Integer-bit is stayed, n is variable element, and n belongs to integer, obtain a 6th one-dimensional matrix M6, the line number of the 6th matrix M6
For d, columns is 1, and the span of each element value in the 6th matrix M6 is
S206, a default two dimension the 7th matrix M7, the 7th matrix M7 line number are c, and columns is d, binaryzation it is described
Each element value in 7th matrix M7 is -1 or+1;And the 8th matrix M8 of a default two dimension, the 8th matrix
M8 line number is c, and columns is d, and the span of each element value in the 8th matrix M8 is between [- 1 ,+1]
Floating number;
S207, the 7th matrix M7 are multiplied by the 4th matrix M4, obtain a 9th one-dimensional matrix M9, the 9th square
Battle array M9 line number is c, and columns is 1, and the span of each element value in the 9th matrix M9 isInteger, the member of every a line described in the step S107 in the 9th matrix M9
The character that element represents representated by a kind of element of every a line in character, the 9th matrix M9 is arranged according to character sequence edge
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 used as prediction character;And
S208, judge whether the prediction character is equal to the character of presently described gray scale picture, if so, then prediction character is accurate,
If it is not, then predicting character errors.
14. it is applied to the neural network training method of gray scale picture as claimed in claim 13, it is characterised in that the step
S201 includes:Each element in first matrix each corresponds to a pixel in the gray scale picture, each described
Element value in corresponding first matrix of pixel is that span is the integer between [0,255].
15. it is applied to the neural network training method of gray scale picture as claimed in claim 13, it is characterised in that the step
S202 includes:It will join end to end to form the second one-dimensional matrix per a line in the first matrix of two dimension, wherein first matrix
Every a line tail end be connected next line head end.
16. it is applied to the neural network training method of gray scale picture as claimed in claim 13, it is characterised in that d=a × b
× e, e span are the integers between [5,20].
17. it is applied to the neural network training method of gray scale picture as claimed in claim 16, it is characterised in that d=a × b
×10。
18. it is applied to the neural network training method of gray scale picture as claimed in claim 13, it is characterised in that the step
S205 includes:Each element of any one activation the 4th matrix M4 in following four activation primitive, it is described
Activation primitive includes:
4
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, columns is 1, and the span of 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 α span is [0,1];
Each element of the 5th matrix M5 is only retained into integer-bit, the 6th matrix M6 is obtained.
19. it is applied to the neural network training method of gray scale picture as claimed in claim 13, it is characterised in that the step
S205 is replaced with reduces 2 by each element shift of the 4th matrix M4nOnly retain integer-bit after times, obtain the 6th square
Battle array M6, the 6th matrix M6 line number are d, and columns is 1, the value model of each element value in the 6th matrix M6
Enclosing is
20. it is applied to the neural network training method of gray scale picture as claimed in claim 13, it is characterised 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 true CN107038451A (en) | 2017-08-11 |
CN107038451B 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) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111242847A (en) * | 2020-01-10 | 2020-06-05 | 上海西井信息科技有限公司 | 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 |
CN105184265A (en) * | 2015-09-14 | 2015-12-23 | 哈尔滨工业大学 | Self-learning-based handwritten form numeric character string rapid recognition method |
CN105184226A (en) * | 2015-08-11 | 2015-12-23 | 北京新晨阳光科技有限公司 | Digital identification method, digital identification device, neural network training method and neural network training device |
-
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 |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111242847A (en) * | 2020-01-10 | 2020-06-05 | 上海西井信息科技有限公司 | Gateway-based image splicing method, system, equipment and storage medium |
CN111242847B (en) * | 2020-01-10 | 2021-03-30 | 上海西井信息科技有限公司 | Gateway-based image splicing method, system, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN107038451B (en) | 2018-09-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JPH0334082A (en) | Computational network for character recognition | |
CN112508190A (en) | Method, device and equipment for processing structured sparse parameters and storage medium | |
JPWO2019053835A1 (en) | Arithmetic circuits, arithmetic methods, and programs | |
CN113159452B (en) | Wind power cluster power prediction method based on time-space correlation | |
CN114359938B (en) | Form identification method and device | |
CN111046915B (en) | Method for generating style characters | |
CN107038451B (en) | Network learning method and training method suitable for gray scale picture | |
CN113343025B (en) | Sparse attack resisting method based on weighted gradient Hash activation thermodynamic diagram | |
Li et al. | Multi-source image fusion algorithm based on cellular neural networks with genetic algorithm | |
CN106980869B (en) | Network learning method and training method suitable for black and white picture | |
CN113935496A (en) | Robustness improvement defense method for integrated model | |
CN107885854A (en) | A kind of semi-supervised cross-media retrieval method of feature based selection and virtual data generation | |
JPH06282686A (en) | Method for character recognition | |
CN101828181B (en) | Data processing device | |
CN115859011B (en) | Matrix operation method, device, unit and electronic equipment | |
Mandal et al. | Hand written English character recognition using column-wise segmentation of image matrix (CSIM) | |
US11531896B2 (en) | Neural network circuit providing for operations with bit shifting and rounded values of weight information | |
CN111639523A (en) | Target detection method, target detection device, computer equipment and storage medium | |
CN111738198B (en) | Intelligent rapid calculation system and method | |
Singh et al. | A new approach to superfractals | |
Vani et al. | High accuracy optical character recognition algorithms using learning array of ANN | |
CN112785376A (en) | Multi-domain recommendation method based on multi-task learning | |
Kussul et al. | LIRA neural classifier for handwritten digit recognition and visual controlled microassembly | |
CN117648846B (en) | Image sample generation method for composite material performance prediction modeling | |
CN117375906A (en) | Hidden beacon sample generation method based on intrusion detection |
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 |
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. |
|
CP01 | Change in the name or title of a patent holder |