The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.

การเขียนโปรแกรม Object Detection ด้วย Python

Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by Niwatori San, 2023-03-10 13:30:43

Object Detection with Python

การเขียนโปรแกรม Object Detection ด้วย Python

Keywords: Object Detection with Python,Object Detection,AI

50 8 Shipping 382 1097 97 23 5 Total 423 1125 56 18 1 i 260 1397 62 62


51 1 253 1584 335 12 2 my 561 1510 33 18 6 client 602 1505 62 18


52 1 664 955 145 201 0 764 1332 44 98


53


54 01 Introduction to Pytesseract Google Colab Notebook for OCR using Pytesseract • https://bhadreshpsavani.medium.com/how-to-use-tesseract-library-for-ocr-in-googlecolab-notebook-5da5470e4fe0 • https://nanonets.com/blog/ocr-with-tesseract/ • 02 Installation • install tesseract-ocr on linux เเละ libtesseract-dev เพื่อใช command line on terminal • install pytesseract สำหรับการเขียนดวย ภาษา python • *install tesseract-ocr-tha for thai * *หมายเหตุ * ใน colab ตอง install ใหมทุกครั้ง เเละหลังจาก install ดวย cell ดานลางจำเปนตอง Restart Runtime ใหม


55


56


57


58 03 Load Example Image file • upload image file ดวย google.colab.files.upload • download file exmaple ที่ link ... (link images) เลือกไฟลthai_2.JPG <matplotlib.image.AxesImage at 0x7f14f844b520>


59 04 OCR Tesseract Functions โดยเเตละฟงกชันจะระบุพารามิเตอรภาษา lang='tha' เชน pytesseract.image_to_string(image, lang="tha") 4.1 image_to_string Text Extraction การดึงขอความ


60 <matplotlib.image.AxesImage at 0x7f14f829d850> 4.3 image_to_data การดึงขอมูลประกอบ 'level', 'page_num', 'block_num', 'par_num', 'line_num', 'word_num', 'left', 'top', 'width', 'height', 'conf', 'text'


61 01 Introduction to Deep Layout parsering • https://layoutparser.readthedocs.io/en/latest/example/deep_layout_parsing/index.html • https://github.com/Layout-Parser/layout-parser 02 Installation • install tesseract original and thai as example 01-02 • install layoutparser • install ocr for layout parser • install layout detection by EfficientDet (effdet) https://arxiv.org/abs/1911.09070v7 • install layout detection by detectron2 https://github.com/facebookresearch/detectron2 *หมายเหตุ * ใน colab ตอง install ใหมทุกครั้ง เเละหลังจาก install ดวย cell ดานลางจำเปนตอง Restart Runtime ใหม


62


63


64 4 Layout Detection 4.1 layout detection with efficientdet Load model pretrained โดยใช effcientdet


65


66


67


68


69


70


71 Keras: the Python deep learning API Keras OCR A packaged and flexible version of the CRAFT text detector and Keras CRNN recognition model based on the project https://github.com/faustomorales/keras-ocr


72


73


74 : Thai Food VISION Recognition (T-Food) บริการระบุชื่ออาหารไทยจากรูปภาพ ดวยเทคนิค Deep Learning ***จัดการและประมวลผลรูปภาพกราฟกใน Python ดวย Pillow https://python3.wannaphong.com/2014/11/image-processing-python.html


75


76


77


78 OUTPUT ผลลัพธที่ไดจาก ระบบรูจำอาหารไทยจะอยูในรูปแบบของ JSON Arrays ตามจำนวนปายที่พบในรูปภาพ ซึ่ง แตละอาเรยจะมีองคประกอบดังนี้ OK : "True" หรือ "False" filename : ชื่อของไฟลภาพที่เซิรฟเวอรรับมา ในกรณีที่ client สง query มาหลายภาพ อาจใชชื่อไฟลนี้ใน การเทียบวาเปนคำตอบจากภาพใด objects : เปนรายการของคำตอบที่นาจะเปน 10 อันดับแรก ในกรณีระบบพบวาคำตอบในรายการนี้มีความ นาจะเปนต่ำมาก (ต่ำกวา 0.1) ระบบจะตัดรายการคำตอบใหสั้นลง โดยจำนวนคำตอบที่นอยที่สุดคือ 1 คำตอบ (Array) label: ชื่อของอาหาร เปน utf-8 string ในกรณีที่คำตอบนี้มีความนาจะเปนต่ำกวา 0.8 ระบบจะเพิ่มคำวา "(นาจะ)" ไวหนาชื่อ และหากความนาจะเปนต่ำกวา 0.1 จะมีคำวา "(เดาวา)" นำหนาชื่ออาหารนี้ rank: ลำดับของคำตอบมีคาได 1-10 โดย 1 คือคำตอบที่เปนไปไดมากที่สุด li> result: ชื่ออาหารไทยที่ได score: คะแนนของคำตอบนี้ มีคาตั้งแต 0 -1


79 ภาพอาหารคือ : ผัดไทยกุงสด score=0.9416062


80 VISION : Thai License Plate Recognition: T-LPR ระบบรูจำปายทะเบียนรถยนตสามารถตรวจหาอักษรภาษาไทยและตัวเลขอารบิกบนปายทะเบียนรถ • lpr: https://api.aiforthai.in.th/lpr • lpr v.2: https://api.aiforthai.in.th/lpr-v2 ***จัดการและประมวลผลรูปภาพกราฟกใน Python ดวย Pillow https://python3.wannaphong.com/2014/11/image-processing-python.html


81 เรียกใช API ตองไปสมัครเพื่อขอ API keyกอน ไปที่ลิงคนี้https://aiforthai.in.th เพื่อขอ API key ในการใชงาน (Apikey ดานลางนี้เปน API key ตัวอยางเอาไว test ตัวอยางเฉยๆ) กรอกขอมูล เพื่อกำหนดคาใหกับตัวแปร


82 OUTPUT ผลลัพธที่ไดจาก ระบบรูจำปายทะเบียนรถยนต จะอยูในรูปแบบของ JSON Arrays ตามจำนวนปายที่พบใน รูปภาพ ซึ่งแตละอาเรยจะมีองคประกอบดังนี้ lpr : ชุดตัวอักษรและตัวเลขของปายทะเบียน (String) bbox : ตำแหนงบนรูปภาพที่พบปายทะเบียน (Array) xLeftTop: ตำแหนง x ของปายทะเบียนมุมซายบน yLeftTop: ตำแหนง y ของปายทะเบียนมุมซายบน xRightBottom: ตำแหนง x ของปายทะเบียนมุมขวาลาง yRightBottom: ตำแหนง y


83


84 แบบทดสอบ หลักสูตรการเขียนโปรแกรม Object Detection ด้วย Python คําสั ่ง จงทําแบบทดสอบต่อไปนี้ทุกข้อเพื่อประเมินผลสัมฤทธ์ิของผู้เข้าอบรมและประเมินการ ผ่านเกณฑ์การได้ประกาศนียบัตร 1) จงเขียนโปรแกรม Face Detection จากภาพหมู ใหไดผลลัพธดังนี้ 2) จงเขียนโปรแกรม Thai License Plate Recognition ใหไดผลลัพธดังนี้


85 3) จงเขียนโปรแกรม OCR ขอความภาษาอังกฤษใหไดผลลัพธดังภาพ แลวเเสดงผลข้อความที่ Confident สูง 4) จงเขียนโปรแกรม OCR ขอความภาษาไทยใหไดผลลัพธดังภาพ แล้วเเสดงผลข้อความที่ Confident สูง


86 Thank your for your attention


Click to View FlipBook Version