[13772] 2019-02-19_CNN+BLSTM+CTC的验证码识别从训练到部署

文档创建者:s7ckTeam
浏览次数:3
最后更新:2025-01-18
2019-02-19_CNN+BLSTM+CTC的验证码识别从训练到部署 C N N + B L S T M + C T C k e r l o m z   F r e e B u f   2 0 1 9 - 0 2 - 1 9   使 使 2 0 1 9 / 0 1 / 2 1 D L L T e n s o r F l o w   A P I h t t p s : / / g i t h u b . c o m / k e r l o m z / c a p t c h a _ l i b r a r y _ c h t t p s : / / g i t h u b . c o m / k e r l o m z / c a p t c h a _ d e m o _ c s h a r p C N N + B L S T M + C T C D e n s e N e t + B L S T M + C T C p r e d i c t - C P U p r e d i c t - G P U C N N 5 + B i - L S T M + H 6 4 + C T C 1 5 m s 2 8 m s 2 m b C N N 5 + B i - L S T M + H 1 6 + C T C 8 m s 2 8 m s 1 . 5 m b D e n s e N e t + B i - L S T M + H 6 4 + C T C 6 0 m s 6 0 m s 6 . 5 m b H 1 6 / H 6 4 B i - L S T M n u m _ u n i t s L S T M t f . c o n t r i b . r n n . L S T M C e l l G P U k e r n e l   G P U   使 G P U 使 C P U h t t p s : / / g i t h u b . c o m / k e r l o m z / c a p t c h a _ p l a t f o r m   C U D A c u D N N p i p T e n s o r F l o w L i n u x V e r s i o n P y t h o n   v e r s i o n C o m p i l e r B u i l d   t o o l s c u D N N C U D A t e n s o r f l o w _ g p u - 1 . 1 2 . 0 2 . 7 ,   3 . 3 - 3 . 6 G C C   4 . 8 B a z e l   0 . 1 5 . 0 7 9 t e n s o r f l o w _ g p u - 1 . 1 1 . 0 2 . 7 ,   3 . 3 - 3 . 6 G C C   4 . 8 B a z e l   0 . 1 5 . 0 7 9 t e n s o r f l o w _ g p u - 1 . 1 0 . 0 2 . 7 ,   3 . 3 - 3 . 6 G C C   4 . 8 B a z e l   0 . 1 5 . 0 7 9 t e n s o r f l o w _ g p u - 1 . 9 . 0 2 . 7 ,   3 . 3 - 3 . 6 G C C   4 . 8 B a z e l   0 . 1 1 . 0 7 9 t e n s o r f l o w _ g p u - 1 . 8 . 0 2 . 7 ,   3 . 3 - 3 . 6 G C C   4 . 8 B a z e l   0 . 1 0 . 0 7 9 t e n s o r f l o w _ g p u - 1 . 7 . 0 2 . 7 ,   3 . 3 - 3 . 6 G C C   4 . 8 B a z e l   0 . 9 . 0 7 9 t e n s o r f l o w _ g p u - 1 . 6 . 0 2 . 7 ,   3 . 3 - 3 . 6 G C C   4 . 8 B a z e l   0 . 9 . 0 7 9 W i n d o w s V e r s i o n P y t h o n   v e r s i o n C o m p i l e r B u i l d   t o o l s c u D N N C U D A t e n s o r f l o w _ g p u - 1 . 1 2 . 0 3 . 5 - 3 . 6 M S V C   2 0 1 5   u p d a t e   3 B a z e l   0 . 1 5 . 0 7 9
t e n s o r f l o w _ g p u - 1 . 1 1 . 0 3 . 5 - 3 . 6 M S V C   2 0 1 5   u p d a t e   3 B a z e l   0 . 1 5 . 0 7 9 t e n s o r f l o w _ g p u - 1 . 1 0 . 0 3 . 5 - 3 . 6 M S V C   2 0 1 5   u p d a t e   3 C m a k e   v 3 . 6 . 3 7 9 t e n s o r f l o w _ g p u - 1 . 9 . 0 3 . 5 - 3 . 6 M S V C   2 0 1 5   u p d a t e   3 C m a k e   v 3 . 6 . 3 7 9 t e n s o r f l o w _ g p u - 1 . 8 . 0 3 . 5 - 3 . 6 M S V C   2 0 1 5   u p d a t e   3 C m a k e   v 3 . 6 . 3 7 9 t e n s o r f l o w _ g p u - 1 . 7 . 0 3 . 5 - 3 . 6 M S V C   2 0 1 5   u p d a t e   3 C m a k e   v 3 . 6 . 3 7 9 t e n s o r f l o w _ g p u - 1 . 6 . 0 3 . 5 - 3 . 6 M S V C   2 0 1 5   u p d a t e   3 C m a k e   v 3 . 6 . 3 7 9 V e r s i o n P y t h o n   v e r s i o n C o m p i l e r B u i l d   t o o l s c u D N N C U D A 使 C U D A c u D N N T e n s o r F l o w G i t h u b w h l 2 . 1   |     |     | |     |     | |   U b u n t u   |   1 6 . 0 4   | | W i n d o w s   |   7   S P 1   | |   M a c O S   |   N / A   | |     |     | |     |     | |   P y t h o n   |   3 . 6   | |   T e n s o r F l o w - G P U   |   1 . 6 . 0   | |   O p e n c v - P y t h o n   |   3 . 3 . 0 . 1 0   | |   N u m p y   |   1 . 1 4 . 1   | |   P i l l o w   |   4 . 3 . 0   | |   P y Y a m l   |   3 . 1 3   | 2 . 1 . 1   U b u n t u   1 6 . 0 4     P y t h o n   3 . 6 1 P y t h o n P y t h o n 3 . 6 / u s r / l o c a l / l i b / u s r / l i b / u s r / l i b 6 4 2 W i n d o w s L i n u x P y t h o n 使 V i r t u a l e n v A n a c o n d a 使 V i r t u a l e n v P y C h a r m P y t h o n   I D E 2 . 1 . 2   U b u n t u   1 6 . 0 4     C U D A / c u D N N U b u n t u   1 6 . 0 4 1 4 . 0 4 S e c u r e B o o t D e s k t o p 1 .   r u n f i l e d e b N V I D I A   h t t p s : / / w w w . g e f o r c e . c n / d r i v e r s C U D A   h t t p s : / / d e v e l o p e r . n v i d i a . c o m / c u d a - d o w n l o a d s T e n s o r F l o w   W h e e l s u d o   a p t - g e t   i n s t a l l   o p e n s s l     s u d o   a p t - g e t   i n s t a l l   l i b s s l - d e v s u d o   a p t - g e t   i n s t a l l   l i b c 6 - d e v   g c c     s u d o   a p t - g e t   i n s t a l l   - y   m a k e   b u i l d - e s s e n t i a l   z l i b 1 g - d e v   l i b b z 2 - d e v   l i b r e a d l i n e - d e v   $   l i b s q l i t e 3 - d e v   w g e t   c u r l   l l v m   t k - d e v   w g e t   h t t p s : / / w w w . p y t h o n . o r g / f t p / p y t h o n / 3 . 6 . 6 / P y t h o n - 3 . 6 . 6 . t g z t a r   - v x f   P y t h o n - 3 . 6 . 6 . t a r . x z c d   P y t h o n - 3 . 6 . 6 . / c o n f i g u r e   - - p r e f i x = / u s r / l o c a l     - - e n a b l e - s h a r e d m a k e   - j 8 s u d o   m a k e   i n s t a l l   - j 8 l i b p y t h o n 3 . 6 m . s o . 1 . 0 p i p 3   i n s t a l l   - r   r e q u i r e m e n t s . t x t v i r t u a l e n v   - p   / u s r / b i n / p y t h o n 3   v e n v   #   v e n v   i s   t h e   n a m e   o f   t h e   v i r t u a l   e n v i r o n m e n t . c d   v e n v /   #   v e n v   i s   t h e   n a m e   o f   t h e   v i r t u a l   e n v i r o n m e n t . s o u r c e   b i n / a c t i v a t e   #   t o   a c t i v a t e   t h e   c u r r e n t   v i r t u a l   e n v i r o n m e n t . c d   c a p t c h a _ t r a i n e r   #   c a p t c h a _ t r a i n e r   i s   t h e   p r o j e c t   p a t h . p i p 3   i n s t a l l   - r   r e q u i r e m e n t s . t x t
c u D N N   h t t p s : / / d e v e l o p e r . n v i d i a . c o m / c u d n n   N V I D I A d e b 2 .   C t r l + a l t + F 1 3 .   N v i d i a   D r i v e r r u n f i l e 使 4 .   C U D A 1 2 )     ~ / . b a s h r c     2 . 1 . 3   W i n d o w s   W i n d o w s U b u n t u P y t h o n C U D A c u D N N 便   使 使 1 0 k b Q Q 8 5 7 1 4 9 4 1 9 m n i s t 3 . 1   s u d o   s e r v i c e   l i g h t d m   s t o p s u d o   c h m o d   a + x   N V I D I A - L i n u x - x 8 6 _ 6 4 - 3 8 4 . 9 0 . r u n   / / s u d o   . / N V I D I A - L i n u x - x 8 6 _ 6 4 - 3 8 4 . 9 0 . r u n   n o - x - c h e c k   n o - n o u v e a u - c h e c k   n o - o p e n g l - f i l e s   / / n v i d i a - s m i s u d o   a p t - g e t   i n s t a l l   f r e e g l u t 3 - d e v   b u i l d - e s s e n t i a l   l i b x 1 1 - d e v   l i b x m u - d e v   l i b x i - d e v   l i b g l 1 - m e s a - g l x   l i b g l u 1 - m e s a   l i b g l u 1 - m e s a - d e v s u d o   s h   c u d a _ 9 . 0 . 1 7 6 _ 3 8 4 . 8 1 _ l i n u x . r u n e x p o r t   P A T H = / u s r / l o c a l / c u d a - 9 . 0 / b i n $ { P A T H : + : $ { P A T H } } e x p o r t   L D _ L I B R A R Y _ P A T H = / u s r / l o c a l / c u d a - 9 . 0 / l i b 6 4 $ { L D _ L I B R A R Y _ P A T H : + : $ { L D _ L I B R A R Y _ P A T H } } s u d o   l d c o n f i g s u d o   s e r v i c e   l i g h t d m   s t a r t c o n f i g . y a m l   #  
T r a i n R e g e x T e s t R e g e x T r a i n s P a t h T e s t P a t h l i s t m a k e _ d a t a s e t . p y t f r e c o r d s m a k e _ d a t a s e t . p y d a t a s e t T r a i n s P a t h T e s t P a t h T e s t P a t h 使 T e s t S e t N u m 使 T e s t S e t N u m T e s t B a t c h S i z e C N N 5 ( C N N 5 ) + B L S T M ( B i d i r e c t i o n a l   L S T M ) + C T C D e n s e N e t 5 0 0 4 0 - 6 0 % 2 0 0 0 0 H i d d e n N u m 8 ~ 6 4 使 D e n s e N e t C N N 5 C N N N e t w o r k #   -   r e q u i r e m e n t . t x t     -     G P U :   t e n s o r f l o w - g p u ,   C P U :   t e n s o r f l o w #   -   I f   y o u   u s e   t h e   G P U   v e r s i o n ,   y o u   n e e d   t o   i n s t a l l   s o m e   a d d i t i o n a l   a p p l i c a t i o n s . #   T r a i n R e g e x   a n d   T e s t R e g e x :   D e f a u l t   m a t c h i n g   a p p l e _ 2 0 1 8 1 0 1 0 1 2 1 2 1 2 . j p g   f i l e . #   -   T h e   D e f a u l t   i s   . * ? ( ? = _ . * . ) #   T r a i n s P a t h   a n d   T e s t P a t h :   T h e   l o c a l   a b s o l u t e   p a t h   o f   y o u r   t r a i n i n g   a n d   t e s t i n g   s e t . #   T e s t S e t N u m :   T h i s   i s   a n   o p t i o n a l   p a r a m e t e r   t h a t   i s   u s e d   w h e n   y o u   w a n t   t o   e x t r a c t   s o m e   o f   t h e   t e s t   s e t #   -   f r o m   t h e   t r a i n i n g   s e t   w h e n   y o u   a r e   n o t   p r e p a r i n g   t h e   t e s t   s e t   s e p a r a t e l y . S y s t e m :     D e v i c e U s a g e :   0 . 7     T r a i n s P a t h :   ' E : T a s k T r a i n s Y o u r M o d e l N a m e '     T r a i n R e g e x :   ' . * ? ( ? = _ ) '     T e s t P a t h :   ' E : T a s k T e s t G r o u p Y o u r M o d e l N a m e '     T e s t R e g e x :   ' . * ? ( ? = _ ) '     T e s t S e t N u m :   1 0 0 0 #   C N N N e t w o r k :   [ C N N 5 ,   D e n s e N e t ] #   R e c u r r e n t N e t w o r k :   [ B L S T M ,   L S T M ] #   -   T h e   r e c o m m e n d e d   c o n f i g u r a t i o n   i s   C N N 5 + B L S T M   /   D e n s e N e t + B L S T M #   H i d d e n N u m :   [ 6 4 ,   1 2 8 ,   2 5 6 ] #   -   T h i s   p a r a m e t e r   i n d i c a t e s   t h e   n u m b e r   o f   n o d e s   u s e d   t o   r e m e m b e r   a n d   s t o r e   p a s t   s t a t e s . N e u r a l N e t :     C N N N e t w o r k :   C N N 5     R e c u r r e n t N e t w o r k :   B L S T M     H i d d e n N u m :   6 4     K e e p P r o b :   0 . 9 8 #   S a v e d S t e p s :   A   S e s s i o n . r u n ( )   e x e c u t i o n   i s   c a l l e d   a   S t e p s , #   -   U s e d   t o   s a v e   t r a i n i n g   p r o g r e s s ,   D e f a u l t   v a l u e   i s   1 0 0 . #   V a l i d a t i o n S t e p s :   U s e d   t o   c a l c u l a t e   a c c u r a c y ,   D e f a u l t   v a l u e   i s   1 0 0 . #   T e s t N u m :   T h e   n u m b e r   o f   s a m p l e s   f o r   e a c h   t e s t   b a t c h . #   -   A   t e s t   f o r   e v e r y   s a v e d   s t e p s . #   E n d A c c :   F i n i s h   t h e   t r a i n i n g   w h e n   t h e   a c c u r a c y   r e a c h e s   [ E n d A c c * 1 0 0 ] % . #   E n d E p o c h s :   F i n i s h   t h e   t r a i n i n g   w h e n   t h e   e p o c h   i s   g r e a t e r   t h a n   t h e   d e f i n e d   e p o c h . T r a i n s :     S a v e d S t e p s :   1 0 0     V a l i d a t i o n S t e p s :   5 0 0     E n d A c c :   0 . 9 7 5     E n d E p o c h s :   1     B a t c h S i z e :   6 4     T e s t B a t c h S i z e :   4 0 0     L e a r n i n g R a t e :   0 . 0 1     D e c a y R a t e :   0 . 9 8     D e c a y S t e p s :   1 0 0 0 0 T r a i n s P a t h :   ' . / d a t a s e t / x x x . t f r e c o r d s ' N e u r a l N e t :     C N N N e t w o r k :   C N N 5     R e c u r r e n t N e t w o r k :   B L S T M     H i d d e n N u m :   6 4     K e e p P r o b :   0 . 9 9 N e u r a l N e t :     C N N N e t w o r k :   D e n s e N e t     . . . . . .
M o d e l N a m e C h a r S e t I m a g e W i d t h I m a g e H e i g h t C h a r S e t A L P H A N U M E R I C _ L O W E R l i s t 使 3 5 0 0 m o d e l . y a m l   #   #   M o d e l N a m e :   C o r r e s p o n d i n g   t o   t h e   m o d e l   f i l e   i n   t h e   m o d e l   d i r e c t o r y , #   -   s u c h   a s   Y o u r M o d e l N a m e . p b ,   f i l l   i n   Y o u r M o d e l N a m e   h e r e . #   C h a r S e t :   P r o v i d e s   a   d e f a u l t   o p t i o n a l   b u i l t - i n   s o l u t i o n : #   -   [ A L P H A N U M E R I C ,   A L P H A N U M E R I C _ L O W E R ,   A L P H A N U M E R I C _ U P P E R , #   - -   N U M E R I C ,   A L P H A B E T _ L O W E R ,   A L P H A B E T _ U P P E R ,   A L P H A B E T ] #   -   O r   y o u   c a n   u s e   y o u r   o w n   c u s t o m i z e d   c h a r a c t e r   s e t   l i k e :   [ ' a ' ,   ' 1 ' ,   ' 2 ' ] . #   C h a r E x c l u d e :   C h a r E x c l u d e   s h o u l d   b e   a   l i s t ,   l i k e :   [ ' a ' ,   ' 1 ' ,   ' 2 ' ] #   -   w h i c h   i s   c o n v e n i e n t   f o r   u s e r s   t o   f r e e l y   c o m b i n e   c h a r a c t e r   s e t s . #   -   I f   y o u   d o n ' t   w a n t   t o   m a n u a l l y   d e f i n e   t h e   c h a r a c t e r   s e t   m a n u a l l y , #   -   y o u   c a n   c h o o s e   a   b u i l t - i n   c h a r a c t e r   s e t #   -   a n d   s e t   t h e   c h a r a c t e r s   t o   b e   e x c l u d e d   b y   C h a r E x c l u d e   p a r a m e t e r . M o d e l :     S i t e s :   [ ]     M o d e l N a m e :   Y o u r M o d e l N a m e - C N N 5 - H 6 4 - 1 5 0 x 5 0     M o d e l T y p e :   1 5 0 x 5 0     C h a r S e t :   A L P H A N U M E R I C _ L O W E R     C h a r E x c l u d e :   [ ]     C h a r R e p l a c e :   { }     I m a g e W i d t h :   1 5 0     I m a g e H e i g h t :   5 0 #   B i n a r y z a t i o n :   [ - 1 :   O f f ,   > 0   a n d   <   2 5 5 :   O n ] . #   S m o o t h i n g :   [ - 1 :   O f f ,   > 0 :   O n ] . #   B l u r :   [ - 1 :   O f f ,   > 0 :   O n ] . #   R e s i z e :   [ W I D T H ,   H E I G H T ]     #   -   I f   t h e   i m a g e   s i z e   i s   t o o   s m a l l ,   t h e   t r a i n i n g   e f f e c t   w i l l   b e   p o o r   a n d   y o u   n e e d   t o   z o o m   i n . #   -   c t c _ l o s s   e r r o r   " N o   v a l i d   p a t h   f o u n d . "   h a p p e n e d P r e t r e a t m e n t :     B i n a r y z a t i o n :   - 1     S m o o t h i n g :   - 1     B l u r :   - 1 C h a r S e t :   [ ' ' ,   ' ' ,   ' ' ,   ' ' ,   ' ' ,   ' ' ,   ' ' ,   ' ' ]
9 5 % I m a g e W i d t h I m a g e H e i g h t 便 P r e t r e a t m e n t 使 使 9 8 % 3 . 2   使 P y C h a r m R u n t r a i n s . p y V i r t u a l e n v 使 p y t h o n 3   t r a i n s . p y
o u t p b y a m l 3 . 3   h t t p s : / / g i t h u b . c o m / k e r l o m z / c a p t c h a _ p l a t f o r m T e n s o r   F l o w G r a p h 1 p b g r a p h y a m l m o d e l 2 m o d e l y a m l g r a p h p b 3 y a m l p b y a m l 便 使 使 使 T e n s o r F l o w g R P C F l a s k T o r n a d o S a n i c F l a s k T o r n a d o S e c r e t K e y A c c e s s K e y d e m o . p y 使 p a c k a g e . p y r e q u i r e m e n t s . t x t c p u T e n s o r F l o w L i n u x
T o r n a d o F l a s k S a n i c g R P C : W i n d o w s W i n d o w s T o r n a d o F l a s k S a n i c W i n d o w s g R P C G o o g l e R P C 3 . 4   / 1 .   F l a s k C o n t e n t - T y p e h t t p : / / l o c a l h o s t : 1 9 9 5 1 / c a p t c h a / v 1 a p p l i c a t i o n / j s o n J S O N P O S T |     |     |     |     | |     |     |     |     | |   i m a g e   |   Y e s   | S t r i n g   |   B a s e 6 4     | |   m o d e l _ s i t e   |   N o   |   S t r i n g   |   y a m l   | |   m o d e l _ t y p e   |   N o   |   S t r i n g   |   y a m l   | J S O N { i m a g e :   b a s e 6 4 } |     |     |     | |   -   |     |     | |   m e s s a g e   |   S t r i n g   |   | |   c o d e   |   S t r i n g   |     | |   s u c c e s s   |   S t r i n g   |     | J S O N { m e s s a g e :   x x x x ,   c o d e :   0 , s u c c e s s :   t r u e } 2 .   T o r n a d o C o n t e n t - T y p e h t t p : / / l o c a l h o s t : 1 9 9 5 2 / c a p t c h a / v 1 a p p l i c a t i o n / j s o n J S O N P O S T 3 .   S a n i c |     |   C o n t e n t - T y p e   |     |     | |   -   |     |     |   | |   h t t p : / / l o c a l h o s t : 1 9 9 5 3 / c a p t c h a / v 1   |   a p p l i c a t i o n / j s o n   |   J S O N   |   P O S T   | 4 .   g R P C g r p c i o g r p c i o _ t o o l s g r p c . p r o t o d e m o . p y #     1 9 9 5 2 p y t h o n 3   t o r n a d o _ s e r v e r . p y #   1     1 9 9 5 1 p y t h o n   f l a s k _ s e r v e r . p y   #   2 使 g u n i c o r n   5 0 0 0 p i p   i n s t a l l   g u n i c o r n   g u n i c o r n   - c   d e p l o y . c o n f . p y   f l a s k _ s e r v e r : a p p #     1 9 9 5 3 p y t h o n 3   s a n i c _ s e r v e r . p y #     5 0 0 5 4 p y t h o n 3   g r p c _ s e r v e r . p y p y t h o n 3   x x x _ s e r v e r . p y
3 . 5   c l a s s   G o o g l e R P C ( o b j e c t ) :         d e f   _ _ i n i t _ _ ( s e l f ,   h o s t :   s t r ) :                 s e l f . _ u r l   =   ' { } : 5 0 0 5 4 ' . f o r m a t ( h o s t )                 s e l f . t r u e _ c o u n t   =   0                 s e l f . t o t a l _ c o u n t   =   0         d e f   r e q u e s t ( s e l f ,   i m a g e ,   m o d e l _ t y p e = N o n e ,   m o d e l _ s i t e = N o n e ) :                 i m p o r t   g r p c                 i m p o r t   g r p c _ p b 2                 i m p o r t   g r p c _ p b 2 _ g r p c                 c h a n n e l   =   g r p c . i n s e c u r e _ c h a n n e l ( s e l f . _ u r l )                 s t u b   =   g r p c _ p b 2 _ g r p c . P r e d i c t S t u b ( c h a n n e l )                 r e s p o n s e   =   s t u b . p r e d i c t ( g r p c _ p b 2 . P r e d i c t R e q u e s t (                         i m a g e = i m a g e ,   s p l i t _ c h a r = ' , ' ,   m o d e l _ t y p e = m o d e l _ t y p e ,   m o d e l _ s i t e = m o d e l _ s i t e                 ) )                 r e t u r n   { " m e s s a g e " :   r e s p o n s e . r e s u l t ,   " c o d e " :   r e s p o n s e . c o d e ,   " s u c c e s s " :   r e s p o n s e . s u c c e s s } i f   _ _ n a m e _ _   = =   ' _ _ m a i n _ _ ' :         r e s u l t   =   G o o g l e R P C ( ) . r e q u e s t ( " b a s e 6 4 " )         p r i n t ( r e s u l t )
h t t p s : / / w w w . j i a n s h u . c o m / p / d a 1 b 9 7 2 e 2 4 f 2 O C R h t t p s : / / g i t h u b . c o m / k e r l o m z / c a p t c h a _ t r a i n e r h t t p s : / / g i t h u b . c o m / k e r l o m z / c a p t c h a _ p l a t f o r m * k e r l o m z F r e e B u f
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则