VIETNAM NATIONAL UNIVERSITY - HO CHI MINH CITY HO CHI MINH UNIVERSITY OF TECHNOLOGY COMPUTER SCIENCE AND ENGINEERING FACULTY ——————– * ——————— GRADUATION THESIS Building A Diagram Recognition Problem with Machine Vision Approach Council: Computer Science Advisor: Dr. Nguyen Duc Dung Reviewer: Dr. Nguyen An Khuong —o0o— Student: Tran Hoang Thinh 1752516 HO CHI MINH CITY, 08/2021 ĐẠI HỌC QUỐC GIA TP.HCM CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM ---------- Độc lập - Tự do - Hạnh phúc TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA: KH & KT Máy tính___ NHIỆM VỤ LUẬN ÁN TỐT NGHIỆP BỘ MÔN: KHMT___________ Chú ý: Sinh viên phải dán tờ này vào trang nhất của bản thuyết trình HỌ VÀ TÊN: Trần Hoàng Thịnh ______________________ MSSV: 1752516 _______ HỌ VÀ TÊN: _____________________________________ MSSV: ______________ HỌ VÀ TÊN: _____________________________________ MSSV: ______________ NGÀNH: ___________________________________ LỚP: ______________________ 1. Đầu đề luận án: Building A Diagram Recognition Problem with Machine Vision Approach 2.
Nhiệm vụ đề tài (yêu cầu về nội dung và số liệu ban đầu): - Investigate approaches in diagram recognition problem - Research on machine learning approaches for the problem - Prepare data for the problem. - Propose and implement the diagram recognition system - Evaluate the proposed model 3. Ngày giao nhiệm vụ luận án: 1/3/2021 4. Ngày hoàn thành nhiệm vụ: 30/6/2021 5.
Họ tên giảng viên hướng dẫn: Phần hướng dẫn: 1) Nguyễn Đức Dũng __________________________________________________________ 2) _________________________________________________________________________ 3) _________________________________________________________________________ Nội dung và yêu cầu LVTN đã được thông qua Bộ môn. CHỦ NHIỆM BỘ MÔN GIẢNG VIÊN HƯỚNG DẪN CHÍNH (Ký và ghi rõ họ tên) (Ký và ghi rõ họ tên) PHẦN DÀNH CHO KHOA, BỘ MÔN: Người duyệt (chấm sơ bộ): ________________________ Đơn vị: _______________________________________ Ngày bảo vệ: ___________________________________ Điểm tổng kết: __________________________________ Nơi lưu trữ luận án: ______________________________ TRƯỜNG ĐẠI HỌC BÁCH KHOA CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM KHOA KH & KT MÁY TÍNH Độc lập - Tự do - Hạnh phúc ---------------------------- Ngày 01 tháng 08 năm 2021 PHIẾU CHẤM BẢO VỆ LVTN (Dành cho người hướng dẫn/phản biện) 1. Họ và tên SV: Trần Hoàng Thịnh MSSV: 1752516 Ngành (chuyên ngành): Computer Science 2. Đề tài: Building A Diagram Recognition Problem with Machine Vision Approach 3.
Họ tên người hướng dẫn/phản biện: Nguyễn Đức Dũng 4. Tổng quát về bản thuyết minh: Số trang: Số chương: Số bảng số liệu Số hình vẽ: Số tài liệu tham khảo: Phần mềm tính toán: Hiện vật (sản phẩm) 5. Tổng quát về các bản vẽ: - Số bản vẽ: Bản A1: Bản A2: Khổ khác: - Số bản vẽ vẽ tay Số bản vẽ trên máy tính: 6. Những ưu điểm chính của LVTN: The team has successfully proposed the diagram recognition system.
They built the initial dataset and perform labeling the data for this task. The team has utilized their knowledge in computer vision and machine learning to propose a suitable approach for this problem. The evaluation results are promising. Những thiếu sót chính của LVTN: The dataset they built is still small and the number of components that this model can recognize is also limited.
Even obtained high accuracy, the team has not performed experiments under real conditions, i. image captured with shadows, low contrast, thin sketches, etc. Đề nghị: Được bảo vệ o Bổ sung thêm để bảo vệ o Không được bảo vệ o 9. 3 câu hỏi SV phải trả lời trước Hội đồng: a.
Đánh giá chung (bằng chữ: giỏi, khá, TB): Giỏi Điểm: 9 /10 Ký tên (ghi rõ họ tên) Nguyễn Đức Dũng TRƯỜNG ĐẠI HỌC BÁCH KHOA CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM KHOA KH & KT MÁY TÍNH Độc lập - Tự do - Hạnh phúc ---------------------------- Ngày 1 tháng 8 năm 2021 PHIẾU CHẤM BẢO VỆ LVTN (Dành cho người hướng dẫn/phản biện) 1. Họ và tên SV: Trần Hoàng Thịnh MSSV: 1752516 Ngành (chuyên ngành): Computer Science 2. Đề tài: “Building A Diagram Recognition Problem with Machine Vision Approach” 3. Họ tên người phản biện: Nguyễn An Khương 4.
Tổng quát về bản thuyết minh: Số trang: 35 Số chương: 6 Số bảng số liệu: 4 Số hình vẽ: 18 Số tài liệu tham khảo: 53 Phần mềm tính toán: Hiện vật (sản phẩm) 5. Tổng quát về các bản vẽ: - Số bản vẽ: Bản A1: Bản A2: Khổ khác: - Số bản vẽ vẽ tay Số bản vẽ trên máy tính: 6. Những ưu điểm chính của LVTN: Thesis topic is interesting and well-choosen. The author clearly understands the problem to be solved and masters the techniques and background knowledge to solve the problem.
The author proposes three algorithms: Algorithms 2 for improving Non Max Suppression, and Algorithms 3,4 for diagram building. The thesis uses Mask R-CNN model and its variant, Keypoint R-CNN with some improvements and augmentation to solve offline diagram recognition task with rather high accuracy (~90%) and acceptable performance (< 2s for each diagram). Những thiếu sót chính của LVTN: The thesis is not well-written and too short. The contributions of the author are not presented in a clear maner.
Đề nghị: Được bảo vệ Bổ sung thêm để bảo vệ Không được bảo vệ 9. Câu hỏi SV phải trả lời trước Hội đồng: a. Is there any commercial or prototype app/software that solve this problem or similar ones? If YES, can you give some comments and remarks on benchmarking your work and those? b. Arrow keypoints seem often coincide with one border of the bounding box, so how should we do to reduce overlap task between arrow keypoint detection and bounding box detection? 10.
Đánh giá chung (bằng chữ: giỏi, khá, TB): Excellent Điểm: 9/10 Ký tên (ghi rõ họ tên) Nguyễn An Khương Declaration We hereby undertake that this is our own research project under the guidance of Dr. Research content and results are truthful and have never been published before. The data used for the analysis and comments are collected by us from many different sources and will be clearly stated in the references. In addition, we also use several reviews and figures of other authors and organizations.
All have citations and origins. If we detect any fraud, we take full responsibility for the content of our graduate in- ternship. Ho Chi Minh City University of Technology is not related to the copyright and copyright infringement caused by us in the implementation process. Best regards, Tran Hoang Thinh Acknowledgments First and foremost, we would like to express our sincere gratitude to our advisor Dr.
Nguyen Duc Dung for the support of our thesis for his patience, enthusiasm, experience, and knowledge. He shared his experience and knowledge which helps us in our research and how to provide a good thesis. We also want to thank Dr. Nguyen An Khuong and Dr.
Le Thanh Sach for their support in reviewing our thesis proposal and thesis. Finally, we would like to show our appreciation to Computer Science Faculty and Ho Chi Minh University of Technology for providing an academic environment for us to become what we are today. Best regards, Tran Hoang Thinh Abstract Diagram has been one of the most effective illustrating tools for demonstrating and sharing ideas and suggestions among others. Besides text and images, drawing flow charts is the best way to give others a clearer path of the plan with the least amount of work.
Nowadays, many meetings require a blackboard so everyone can express their thoughts. This raises a problem with saving these drawings as a reference for future use since taking a picture can not solve the problem of re-editing these ideas and they need to be redrawn to be suitable in professional documents. On the other hand, digitizing the chart requires redrawing the entire diagram using a computer or a special device like drawing boards and digital pens, which cost a lot and are not the most convenient tools to use. Therefore, it is necessary to find a way to convert the current, traditional hand-drawing diagrams into a digital version, simplifying the sharing process between users.
Moreover, the digitizing diagram also helps the user to modify and convert to other forms that satisfy their requirements. This thesis will focus on stating a problem with digitizing diagrams and proposing the solution.1 Object detection methods .3 CNN-based Detector .1 CNN-based Two Stages Detection (Region Proposal based) .2 CNN-based One Stage Detection (Regression/Classification based) .2 Region Proposal Network .3 Non-Maximum Suppression .2 Feature Pyramid Network .3 Region of Interest Align .1 Scope of the thesis .1 Feature map generator .3 Loss function and summary .3 Symbol-Arrow relationship .4 Text-Others relationship. 37 5 Experiments and Results 38 5.1 Perform training and inference without keypoints .2 Perform training and inference with keypoints .3 Building diagram structure from predictions. 46 List of Tables 4.2 Graph building technique experiment.
44 iii List of Figures 3.1 ResNet50 model, from [1] .2 Non-Maximum Suppression, from [2] .3 MaskRCNN model, from [3] .4 Mask Sample, the pink colored pixels are for the object .5 Feature Pyramid Network, from [4] .6 RoIPooling in Faster R-CNN .7 RoIAlign layer used in Mask R-CNN .1 Sample of an entry in DiDi dataset .2 Python code to save a drawing as PNG image .3 A sample with its labels and the JSON label information.4 Sample drawing with bounding boxes .5 Pipeline of the model .6 Feature Pyramid Network with ResNet, from [5] .7 A drawing with its predictions .9 Model fails to detect intersected arrows .10 Example when Euclidean distance does work .11 Sample for Weighted Euclidean .2 Sample prediction with rotated input .3 Loss over iteration of proposed model without keypoints .4 Sample diagram without text .5 Sample diagram with text .6 Loss over iteration of proposed model with keypoints .7 Drawing without predictions at 60% score .8 Example of impossibility in prediction .9 Sample output result. 45 iv List of Algorithms 1 Non-Maximum Suppression. 10 2 DiDi image generation. 20 3 COCO Format Generation.
24 4 Improved Non-Maximum Suppression. 33 6 Weighted Euclidean for Symbol-Arrow relationship .1 Overview Comparing to many decades ago, artificial intelligence (AI) has developed faster than any- one can imagine. Tracing back to the 90s, right after the second “AI Winter” ended, there had been numerous advances where computers successfully achieved milestones that used to be be- lieved as impossible. In 1994, Chinook[6], a checker (English draughts) engine, won the United States tournament by an enormous margin.
It beat the second-best player Don Lafferty while making Marion Tinsley, the best at the time, withdraw in the middle of the game. 1997 on the other hand is the year that would change the history of chess forever when the Deep Blue[7] chess machine from IBM defeated Grandmaster Gary Kasparov with the score of 3½ to 2½. In the same year, Logistello[8] beat the world champion, Takeshi Murakami, with an overwhelm- ing score of six to zero. Nowadays, AI can be seen everywhere in modern life, from work-related examples like email spam filters, virtual assistants to the entertainment industry like recommen- dation systems, chatting, gaming bot, voice and text recognition,.
AlphaZero [9], developed by Google DeepMind, defeated the reigning champion, Stockfish, in a one-side match with the re- sult of 28 wins, 72 draws, and zero losses. Another project, AlphaGo [10], beat the champion, Lee Sedol at 4 - 1, making the history of artificial intelligence the first time a computer had beaten a human in Go. Within the area of computer vision, a subset of artificial intelligence that deals with the science of enabling computers or engines to visualize images, a smaller section deals with the ability to detect objects, for example, humans, animals, furniture, etc. Recently, there have been many applications that can help deal with this task.
Google Lens[11] is an image recognition technology developed by Google, which can detect objects, texts, bar codes, QR codes, math equations,.