跳到主要內容

OCR應用在電子元件上的辨識

 OCR Application


Example1: for SMD idenfication:

Text detect by CRAFT

 

OCR文字偵測


原始照片為網路上下載,再套上OCR文字偵測顯示結果,若有侵權請告知移除
彩色區域為偵測到文字的部份


Output 10 coordinates of corresponding text blocks

1.  144,196,286,194,287,259,145,261
2.  298,198,509,196,509,259,298,262
3.  148,262,286,262,286,321,148,321
4.  368,266,513,264,513,321,369,323
5.  145,331,472,333,471,395,145,393
6.  146,404,445,404,445,454,146,454
7.  146,453,512,453,512,502,146,502
8.  147,502,481,499,481,551,148,553
9.  148,550,614,550,614,600,148,600
10.513,600,714,600,714,648,513,648

 After image pre-processing:

 

 OCR result1:


  After image pre-processing:

 OCR result2:

 

 

Example2: for datasheet interpretation:

Text detect of TI datasheet by CRAFT


OCR results:

([[75, 11], [127, 11], [127, 31], [75, 31]], 'TEXAS', 0.999188403930061)
([[474, 4], [928, 4], [928, 32], [474, 32]], 'PACKAGE MATERIALS INFORMATION', 0.6743955072876302)
([[77, 29], [189, 29], [189, 47], [77, 47]], 'INSTRUMENTS', 0.9648384864438728)
([[37, 69], [105, 69], [105, 83], [37, 83]], 'WWM Ii.com', 0.2591723778552562)
([[851, 67], [927, 67], [927, 83], [851, 83]], '17-Dec-2020', 0.9694632061866851)
([[36, 116], [334, 116], [334, 140], [36, 140]], 'TAPE AND REEL INFORMATION', 0.9635275648694305)
([[77, 153], [209, 153], [209, 173], [77, 173]], 'REEL DIMENSIONS', 0.9998498148196943)
([[519, 153], [649, 153], [649, 171], [519, 171]], 'TAPE DIMENSIONS', 0.9997295073411925)
([[501, 177], [523, 177], [523, 193], [501, 193]], 'KO', 0.5158395828404266)
([[547, 177], [575, 177], [575, 193], [547, 193]], 'P1', 0.9455686092981291)
([[277, 265], [311, 265], [311, 281], [277, 281]], 'Reel', 0.7803041934967041)
([[263, 281], [325, 281], [325, 297], [263, 297]], 'Diameter', 0.9999848270868563)
([[482, 292], [525, 292], [525, 311], [482, 311]], 'Cavity', 0.9210923809942128)
([[575, 291], [597, 291], [597, 309], [575, 309]], 'AO', 0.6634183015102135)
([[411, 321], [777, 321], [777, 337], [411, 337]], 'Dimension designed t0 accommodate the component width', 0.867950833608363)
([[411, 337], [783, 337], [783, 355], [411, 355]], 'Dimension designed t0 accommodate the component lenglh', 0.5326388348994303)
([[410, 354], [803, 354], [803, 372], [410, 372]], 'Dimension designed to accommodate the component thickness', 0.833407196857614)
([[411, 373], [607, 373], [607, 387], [411, 387]], 'Overall width of the carrier lape', 0.8950718833069984)
([[411, 391], [661, 391], [661, 405], [411, 405]], 'Pitch between successive cavity centers', 0.8034738021947719)
([[273, 435], [379, 435], [379, 453], [273, 453]], 'Reel Width (W1)', 0.46326035723651526)
([[211, 453], [461, 453], [461, 473], [211, 473]], 'QUADRANT ASSIGNMENTS FOR PIN', 0.9963498234249092)
([[473, 457], [627, 457], [627, 473], [473, 473]], 'ORIENTATION IN TAPE', 0.9946526883413003)
([[579, 485], [677, 485], [677, 501], [579, 501]], 'Sprocket Holes', 0.8864782738301257)
([[359, 537], [381, 537], [381, 551], [359, 551]], '02', 0.79855056080002)
([[419, 573], [441, 573], [441, 589], [419, 589]], '03', 0.9665244876000211)
([[455, 573], [477, 573], [477, 587], [455, 587]], '04', 0.7811954083920432)
([[557, 571], [699, 571], [699, 587], [557, 587]], 'User Direction of Feed', 0.7642206626169022)
([[371, 635], [487, 635], [487, 651], [371, 651]], 'Pocket Quadrants', 0.9271827968630615)
([[43, 673], [199, 673], [199, 687], [43, 687]], 'All dimensions are nomina', 0.9420986204801013)
([[101, 695], [149, 695], [149, 711], [101, 711]], 'Device', 0.9991779633515514)
([[210, 693], [333, 693], [333, 713], [210, 713]], 'Package |Package', 0.7039944657559438)
([[341, 695], [371, 695], [371, 711], [341, 711]], 'Pins', 0.9980747103691101)
([[391, 695], [423, 695], [423, 711], [391, 711]], 'SPQ', 0.9748639491626118)
([[455, 695], [487, 695], [487, 711], [455, 711]], 'Reel', 0.9999948740005493)
([[519, 695], [547, 695], [547, 711], [519, 711]], 'Reel', 0.8327087175396152)
([[581, 695], [603, 695], [603, 711], [581, 711]], 'Ao', 0.43958669404583417)
([[679, 695], [701, 695], [701, 711], [679, 711]], 'Ko', 0.7125325255699436)
([[831, 695], [861, 695], [861, 711], [831, 711]], 'Pinl', 0.9302820563316345)
([[221, 709], [257, 709], [257, 729], [221, 729]], 'Type', 0.9999449253082275)
([[274, 709], [333, 709], [333, 729], [274, 729]], 'Drawing', 0.6588587928000398)
([[441, 711], [503, 711], [503, 727], [441, 727]], 'Diameter]', 0.4454272609469556)
([[515, 711], [555, 711], [555, 727], [515, 727]], 'Width', 0.876041768773338)
([[573, 711], [609, 711], [609, 727], [573, 727]], '(mm)', 0.8557351242820257)
([[623, 713], [659, 713], [659, 727], [623, 727]], '(mm)', 0.9461450576782227)
([[671, 711], [707, 711], [707, 727], [671, 727]], '(mm)', 0.9999163746833801)
([[719, 711], [757, 711], [757, 727], [719, 727]], '(mm)', 0.8036057401622272)
([[769, 711], [807, 711], [807, 727], [769, 727]], '(mm)', 0.9989970922470093)
([[815, 711], [879, 711], [879, 727], [815, 727]], 'Quadrant', 0.8622102239886623)
([[453, 727], [489, 727], [489, 741], [453, 741]], '(mm)', 0.9924454092979431)
([[503, 727], [565, 727], [565, 741], [503, 741]], 'WI (mm)', 0.7676227538381624)
([[74, 746], [172, 746], [172, 762], [74, 762]], 'CD40192BNSR', 0.9991243569694064)
([[229, 749], [251, 749], [251, 763], [229, 763]], 'SO', 0.6288756878957342)
([[293, 747], [315, 747], [315, 763], [293, 763]], 'NS', 0.9976763085484702)
([[389, 749], [425, 749], [425, 763], [389, 763]], '2000', 0.999133825302124)
([[451, 749], [489, 749], [489, 763], [451, 763]], '330.0', 0.9975234746438764)
([[519, 749], [549, 749], [549, 763], [519, 763]], '16.4', 0.9038805773204304)
([[579, 749], [603, 749], [603, 763], [579, 763]], '8.2', 0.9994752927169485)
([[625, 747], [655, 747], [655, 763], [625, 763]], '10.5', 0.958955619982524)
([[677, 749], [701, 749], [701, 763], [677, 763]], '2.5', 0.9993891985480049)
([[723, 749], [753, 749], [753, 763], [723, 763]], '12.0', 0.9999243021011353)
([[773, 749], [803, 749], [803, 763], [773, 763]], '16.0', 0.9998359680175781)
([[75, 771], [173, 771], [173, 787], [75, 787]], 'CD40193BNSR', 0.9757049564359923)
([[229, 771], [251, 771], [251, 787], [229, 787]], 'SO', 0.43406229753678177)
([[293, 771], [315, 771], [315, 787], [293, 787]], 'NS', 0.9958551861943805)
([[343, 769], [365, 769], [365, 787], [343, 787]], '16', 0.9999985670074514)
([[389, 771], [425, 771], [425, 787], [389, 787]], '2000', 0.9932358860969543)
([[451, 771], [491, 771], [491, 787], [451, 787]], '330.0', 0.9315210972130422)
([[519, 771], [549, 771], [549, 787], [519, 787]], '16.4', 0.8763715137176155)
([[579, 771], [603, 771], [603, 787], [579, 787]], '8.2', 0.9993097120080295)
([[625, 771], [655, 771], [655, 787], [625, 787]], '10.5', 0.9990535378456116)
([[677, 771], [701, 771], [701, 787], [677, 787]], '2.5', 0.9995574650566987)
([[723, 771], [755, 771], [755, 787], [723, 787]], '12.0', 0.9997783303260803)
([[771, 771], [803, 771], [803, 787], [771, 787]], '16.0', 0.9996285438537598)
([[73, 793], [175, 793], [175, 809], [73, 809]], 'CD40193BPWR', 0.7635567491218438)
([[213, 791], [265, 791], [265, 809], [213, 809]], 'TSSOP', 0.9993041963137763)
([[293, 795], [317, 795], [317, 809], [293, 809]], 'PW', 0.9953903140902491)
([[389, 793], [425, 793], [425, 809], [389, 809]], '2000', 0.9965981245040894)
([[451, 793], [491, 793], [491, 809], [451, 809]], '330.0', 0.9999706783410108)
([[519, 793], [549, 793], [549, 809], [519, 809]], '12.4', 0.7921676598867475)
([[579, 795], [603, 795], [603, 809], [579, 809]], '6.9', 0.9979926986551102)
([[627, 793], [653, 793], [653, 811], [627, 811]], '5.6', 0.9427584567925367)
([[677, 793], [701, 793], [701, 809], [677, 809]], '1.6', 0.9420010899908803)
([[727, 795], [751, 795], [751, 809], [727, 809]], '8.0', 0.9992801198328968)
([[773, 793], [803, 793], [803, 809], [773, 809]], '12.0', 0.7524788050885077)



M​ore examples:






留言

這個網誌中的熱門文章

增強式學習

   迴力球遊戲-ATARI     賽車遊戲DQN-ATARI 賽車遊戲-TORCS Ref:     李宏毅老師 YOUTUBE DRL 1-3 On-policy VS Off-policy On-policy     The agent learned and the agent interacting with the environment is the same     阿光自已下棋學習 Off-policy     The agent learned and the agent interacting with the environment is different     佐助下棋,阿光在旁邊看 Add a baseline:     It is possible that R is always positive     So R subtract a expectation value Policy in " Policy Gradient" means output action, like left/right/fire gamma-discounted rewards: 時間愈遠的貢獻,降低其權重 Reward Function & Action is defined in prior to training MC v.s. TD MC 蒙弟卡羅: critic after episode end : larger variance(cuz conditions differ a lot in every episode), unbiased (judge until episode end, more fair) TD: Temporal-difference approach: critic during episode :smaller variance, biased maybe atari : a3c  ...

Frameworks overview

Picture courtesy from Paul Huang

tensorflow

TensorFlow Docker requirements Install Docker  on your local  host  machine. For GPU support on Linux,  install nvidia-docker . Docker is the easiest way to enable TensorFlow  GPU support  on Linux since only the  NVIDIA® GPU driver  is required on the  host  machine  (the  NVIDIA® CUDA® Toolkit  does not need to be installed). docker run [-it] [--rm] [-p hostPort:containerPort] tensorflow/tensorflow[:tag] [command] $ docker run -it --rm tensorflow/tensorflow    python -c "import tensorflow as tf; print(tf.__version__)" Note:   nvidia-docker  v1 uses the  nvidia-docker  alias, where v2 uses  docker --runtime=nvidia . CUDA 9.0 for TensorFlow < 1.13.0 nvidia-docker2 intsall prerequisites: NVIDIA driver  and Docker  . If you have a custom  /etc/docker/daemon.json , the  nvidia-docker2  package might override it....