VIETNAM NATIONAL UNIVERSITY - HO CHI MINH CITY HO CHI MINH UNIVERSITY OF TECHNOLOGY COMPUTER SCIENCE AND ENGINEERING FACULTY ——————– * ——————— GRADUATION THESIS Building A Diagram Recognition Application with Computer Vision Approach Committee: Computer Science 1 Advisor: Dr. Nguyen Duc Dung Reviewer: Dr. Tran Tuan Anh —–o0o—– Students: Huynh Tan Thanh 1752048 Nguyen Quang Sang 1752465 HO CHI MINH CITY, 12/2021 A萎K"J窺E"SW渦E"IKC"VR0JEO E浦PI"JñC"ZÊ"J浦K"EJ曳"PIJ C"XK烏V"PCO ---------- A瓜e"n壱r"- V詠"fq"- J衣pj"rj¿e VT姶云PI"A萎K"J窺E"DèEJ"MJQC KHOA: KH & KT Máy tính PJK烏O"X影"NW一P"èP"V渦V"PIJK烏R D浦"OðP<"KHMT Ej¿"#<"Ukpj"xk‒p"rjVk"fƒp"vぜ"p {"x q"vtcpi"pjXv"eてc"dVp"vjw{xv"vt·pj J窺"XÉ"VçP<"PIW[右P"QUANG SANG MSSV: 1752465 J窺"XÉ"VçP<"JW PJ"V遺P"VJÉPJ MSSV: 1752048 NGÀNH: KHMT N閏R<"CLC-K2017 30"A亥w"8隠"nw壱p"ƒp<" ÐZ¤{"f詠pi"泳pi"f映pi"pj壱p"fk羽p"n逢w"8欝"u穎"f映pi"eƒej"vk院r e壱p"e栄c"vj鵜"ikƒe"oƒ{"v pjÑ (Building A Diagram Recognition Application with Computer Vision Approach) 40"Pjk羽o"x映"*{‒w"e亥w"x隠"p瓜k"fwpi"x "u嘘"nk羽w"dcp"8亥w+< - Investigate approaches in computer vision for diagram recognition problem - Design the framework and the processing pipeline for the diagram recognition system - Collect data and perform labeling tasks on the data - Implement the recognition model, which uses both the DL approach and traditional Computer vision algorithms in the pipeline - Implement the mobile application - Evaluating the application and performance of the proposed system 50"Pi {"ikcq"pjk羽o"x映"nw壱p"ƒp<"3712;14243 60"Pi {"jq p"vj pj"pjk羽o"x映<"3513414243 70"J丑"v‒p"ik違pi"xk‒p"j逢噂pi"f磯p< Rj亥p"j逢噂pi"f磯p< 1) TS. Piw{宇p"A泳e"F pi, Khoa KH&KT Máy tính P瓜k"fwpi"x "{‒w"e亥w"NXVP"8«"8逢嬰e"vj»pi"swc"D瓜"o»p0 Pi {"00000000"vjƒpi"2;0"p<o"4243 EJ曳"PJK烏O"D浦"OðP IK謂PI"XKçP"J姶閏PI"F郁P"EJëPJ *M#"x "ijk"t "jが"v‒p+ *M#"x "ijk"t "jが"v‒p+ RIU0"VU0"Jw pj"V逢運pi"Piw{‒p" Piw{宇p"A泳e"F pi RJYP"FÉPJ"EJQ"MJQC."Dし"OðP< Pi逢運k"fw{羽v"*ej医o"u挨"d瓜+< A挨p"x鵜< Pi {"d違q"x羽< Ak吋o"v鰻pi"m院v< P挨k"n逢w"vt英"nw壱p"ƒp< VT姶云PI"A萎K"J窺E"DèEJ"MJQC E浦PI"JñC"ZÊ"J浦K"EJ曳"PIJ C"XK烏V"PCO KHOA KH & KT MÁY TÍNH A瓜e"n壱r"- V詠"fq"- J衣pj"rj¿e ---------------------------- Pi {"42"vjƒpi"34"p<o"4243 RJK蔭W"EJ遺O"D謂Q"X烏"NXVP *F pj"ejq"pi⇔ぜk"j⇔ずpi"fdp+ 30"J丑"x "v‒p"UX<"Piw{宇p"Swcpi"Ucpi."Jw pj"V医p"Vj pj MSSV: 1752465, 1752048 Ngành (chuyên ngành): KHMT 40"A隠"v k<" Z¤{"f詠pi"泳pi"f映pi"pj壱p"fk羽p"n逢w"8欝"u穎"f映pi"eƒej"vk院r"e壱p"e栄c"vj鵜"ikƒe"oƒ{"v pj (Building A Diagram Recognition Application with Computer Vision Approach) 3.
H丑"v‒p"pi逢運k"j逢噂pi"f磯p<"VU0"Piw{宇p"A泳e"F pi 60"V鰻pi"swƒv"x隠"d違p"vjw{院v"okpj< U嘘"vtcpi<" U嘘"ej逢挨pi<" U嘘"d違pi"u嘘"nk羽w U嘘"j·pj"x胤< U嘘"v k"nk羽w"vjco"mj違q<" Rj亥p"o隠o"v pj"vqƒp< Jk羽p"x壱v"*u違p"rj育o+ 70"V鰻pi"swƒv"x隠"eƒe"d違p"x胤< - U嘘"d違p"x胤< D違p"C3< D違p"C4< Mj鰻"mjƒe< - U嘘"d違p"x胤"x胤"vc{ U嘘"d違p"x胤"vt‒p"oƒ{"v pj< 80"Pj英pi"逢w"8k吋o"ej pj"e栄c"NXVP< - The students proposed a solution for the diagram recognition problem, which utilizes the advantages of computer vision techniques and machine learning approaches. In addition, the students have successfully built a mobile application that allows users to interact with the system easier. The application was built with useful features and easy to use interface. - The students also did a lot of evaluation as well as proposed some improvement in the recognition algorithm.
90"Pj英pi"vjk院w"u„v"ej pj"e栄c"NXVP< - Some algorithms used in the project are not so advanced and may not be able to handle some difficult cases in the problem. - The evaluation results are promising but still need to improve further, especially when investigating various cases in recognition. :0"A隠"pij鵜<"A逢嬰e"d違q"x羽" D鰻"uwpi"vj‒o"8吋"d違q"x羽" Mj»pi"8逢嬰e"d違q"x羽" ;0"O瓜v"u嘘"e¤w"j臼k"UX"rj違k"vt違"n運k"vt逢噂e"J瓜k"8欝pi< a. 320"Aƒpj"ikƒ"ejwpi"*d茨pi"ej英<"ik臼k."VD+<"Ik臼k Ak吋o<"9/10 M#"v‒p"*ijk"t "j丑"v‒p+ VU0"Piw{宇p"A泳e"F pi VT姶云PI"A萎K"J窺E"DèEJ"MJQC E浦PI"JñC"ZÊ"J浦K"EJ曳"PIJ C"XK烏V"PCO KHOA KH & KT MÁY TÍNH A瓜e"n壱r"- V詠"fq"- J衣pj"rj¿e ---------------------------- Ngày 27 tháng 12 p<o 2021 RJK蔭W"EJ遺O"D謂Q"X烏"NXVP *F pj"ejq"pi⇔ぜk"j⇔ずpi"fdp1rjVp"dkうp+ 30"J丑"x "v‒p"UX< Nguy宇n Quang Sang, Hu nh T医n Th nh MSSV: 1752465, 1752048 Ngành (chuyên ngành): Khoa H丑e"Oáy Tính 40"A隠"v k< Building A Diagram Recognition Application with Computer Vision Approach 50"J丑"v‒p"pi逢運k"j逢噂pi"f磯p1rj違p"dk羽p< Tr亥p"Vw医p"Cpj 60"V鰻pi"swƒv"x隠"d違p"vjw{院v"okpj< U嘘"vtcpi< U嘘"ej逢挨pi< U嘘"d違pi"u嘘"nk羽w U嘘"j·pj"x胤< U嘘"v k"nk羽w"vjco"mj違q< Rj亥p"o隠o"v pj"vqƒp< Jk羽p"x壱v"*u違p"rj育o+ 70"V鰻pi"swƒv"x隠"eƒe"d違p"x胤< - U嘘"d違p"x胤< D違p"C3< D違p"C4< Mj鰻"mjƒe< - U嘘"d違p"x胤"x胤"vc{ U嘘"d違p"x胤"vt‒p"oƒ{"v pj< 80"Pj英pi"逢w"8k吋o"ej pj"e栄c"NXVP< - The thesis presents a system that can convert handwritten flowcharts into digital documents.
- The system is built quite full of features and has a good application demo. - This thesis has quite a large amount of work including recognizing shapes, handwriting, arrows and building demo app. - The thesis has experiments and is quite fully cited. This thesis also presents quite detailed algorithms and models 90"Pj英pi"vjk院w"u„v"ej pj"e栄c"NXVP< - This application requires many techniques combined, leading to a lot of work in many technique areas.
This is also one of the weaknesses of the thesis when the research works on the topic have not been strongly developed. For example, the handwriting entry. The team can focus on developing a few key techniques instead of all of them, the rest can use existing results. - The evaluation parameters are not detailed and user-oriented, for example, is the assessment of the arrow considered fair for all arrow types? - The data used to train the model is not clearly presented.
The application should explore more about usability, adapting to the user, instead of just focusing on general accuracy. - Models should be analyzed in more detail, rather than just using it. A隠"pij鵜<"A逢嬰e"d違q"x羽" D鰻"uwpi"vj‒o"8吋"d違q"x羽" Mj»pi"8逢嬰e"d違q"x羽" ;0"5"e¤w"j臼k"UX"rj違k"vt違"n運k"vt逢噂e"J瓜k"8欝pi< a. The evaluation methods proposed in this thesis is effective? For example, is the assessment of the arrow considered fair for all arrow types? is there any general evaluation for the application? b.
What are the main strengths of this thesis? Also, what is the main point that users should use your app? c. What is your next research priority? 320"Aƒpj"ikƒ"ejwpi"*d茨pi"ej英<"ik臼k."VD+< Gi臼k Ak吋o"<"""""8.7 /10 M#"v‒p"*ijk"t "j丑"v‒p+ Tr亥p"Vw医p"Cpj 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.
Additionally, a number of reviews and figures of other authors and organizations we use will have citations and origins clearly stated in the report. If we detect any fraud, we take full responsibility for the content of our graduation thesis. Ho Chi Minh City University of Technology is not related to the copyright and copyright infringement caused by us in the implementation process. Nguyen Quang Sang Huynh Tan Thanh Acknowledgments We would like to express my deepest thanks to Dr.Nguyen Duc Dung for the continuous support in studying and implementing this thesis.
This project would not have been possible without your thoughtful and passionate guides. Besides our advisor, we would also like to thank all of our faculty lecturers, who gave us the valuable knowledge to do this wonderful project. With the invaluable experience from this golden opportunity, we became more confident in our research ability and technical skills. We strongly believe that there is no perfection, especially in the science field.
With that in mind, we will always have room for more enhancement and would love to hear your opinion about any improvement. Best regards, Nguyen Quang Sang Huynh Tan Thanh Abstract Graphical language has been and is always one of the most effective tools for demonstrating ideas to others. Besides text and images, a flow chart plays a vital role in providing people a clearer view of a plan, or a process with simple symbols, notations. Nowadays, many meetings still enjoy the traditional way by using board, paper to draw diagrams expressing their thoughts on the topics discussed.
A problem occurs when saving these drawings as a reference for future purposes since we cannot edit the diagram taken from the picture. These drawn pictures need to be re-drawn by some tools to be suitable in professional documents. In addition, the re-drawn tool can be a computer or a particular device like electronics drawing boards and digital pens, which cost a lot and is not the most convenient tools to use. Therefore, a new approach is necessary to convert hand-drawing charts pictures into digital ones.
The approach can help us avoid re-drawn tasks, simplify the sharing process between users, and be able to export them into another form like picture files (png, jpg), document files (pdf), or standard diagram editing files (drawio). The application must be able to run on popular platforms and accessible to everyone.3 Diagram recognition applications on mobile devices .3 Handwriting Text recognition .2 Regional Proposal Network .3 Non-Maximum Suppression .4 Region of Interest Pooling (RoI Pooling) .2 Feature Pyramid Network .3 Region of Interest Align (RoI Align) .3 Handwriting Text Recognition .1 Long Short Term Memory (LSTM) .2 Gated Recurrent Unit (GRU) .4 Connectionist Temporal Classification (CTC) .1 Diagram Recognition Approach .1 Preparing diagram dataset .1 Feature map generator .4 Symbol-Arrow relationship .5 The relationship of text .2 Handwriting Text Recognition Approach .3 Digital diagram output format .1 Diagram File Design .2 Login/Register Screen .2 Create from blank .1 Converting to drawio files .8 Version and History .2 Experiments on the recognition pipeline .1 Perform training and evaluation on HTR model .2 Perform training and evaluation on diagram recognition model .3 Perform experiments on the combination of diagram recognition model and HTR model .3 Display diagram on device .1 Interactive Viewer and Matrix4 .2 Rendering diagram recognition on device. 63 7 Conclusion and Future Work 68 7. 69 A Usecase detail 70 B User interface design 83 B.1 Login/Register Screen .1 Login and register .2 Home screen options.
100 List of Tables 4.1 Statistics of DIDI images[26] .1 Number of symbols in dataset .2 Measure Arrow Average Precision .3 Evaluation summary of the two models .3 Usecase: Sign up.4 Usecase: Create new diagram.5 Usecase: Scan diagram with camera.6 Usecase: Scan from image.7 Usecase: Preview Diagram.8 Usecase: Export file.9 Usecase: Modify diagram.10 Usecase: Delete Diagram.12 View version history. 82 iv List of Figures 2.1 Flor-HTR architecture [35] .2 Anchor Box in RPN [46] .3 Result of a Non-Maximum Suppression application[47] .4 Region of Interest Pooling[48] .5 Mask R-CNN architecture[51] .6 Binary mask sample in diagram recognition .7 Feature Pyramid Network[53] .8 Region of Interest Align [54] .9 Long Short Term Memory [56] .10 Gated Recurrent Unit [57] .12 Horizontal position of characters [60] .13 Character-score Matrix [60], the black lines presents the path to get character "a" ("aa", "a-" and "-a"), while the dash line presents the character "" ("–") .2 A original sample of FC dataset (left) and preprocessed result (right) .3 Our drawn image (left) and the preprocessed result (right) .5 Feature Pyramid Network with ResNet[63] .6 A prediction of our model .7 Example of Eucludian Distance not working .9 Line segmentation sample .10 Diagram recognized image .11 Model JSON output .1 System Architecture Design .3 Diagram JSON file design .5 Login/Register Screen .2 Experiment results of figure 6. (a) The warped image of figure 6.1a after applying perspective transformation and grayscale conversion; (b) The binary image converted from (a) .3 Experiment results of figure 6.1b after resizing and grayscale conversion; (b) the binary image converted from figure (a).4 Inference results from model training with DIDI dataset images only .5 Inference results from model training with new dataset .6 Loss and validate loss over epoch of HTR model .7 Loss over iterations of diagram recognition model .8 Inference results at above 0.9 (a) Normal text box and (b) Padded text box .10 Small boxes in sub function .11 Inference with problem drawings .12 Example of matrix4 .13 Interactive space using identity matrix .14 Scaling in X and Y .16 Moving the space .17 Diagram display result .18 Rendering drawn diagram pictures on a mobile device .4 Turn off save a copy .1 Overview Diagram has quickly risen to become one of the efficient communication method that has replaced text for demonstrating certain types of information such as algorithms, business pro- cess models, and production structure. The ideas proposed that visualized by diagrams are more clear than any word can do, which helps viewers easily comprehend the key ideas, how it works, and so on.
Additionally, people tend to process information visually and be able to remember graphical information more readily than anything we read. The powerful effects of diagrams are able to be seen in many common events which we often attend, presentations. It will be a night- mare for the audience if a presentation only uses words, numbers to describe the knowledge. The inability to absorb the raw knowledge in a limited time will lead to most of them are leaked and the failure of the presentation is inevitable.
On the other hand, with informative diagrams or pictures, their presentation will be more catchy and comprehensive, thus helps audiences understand the illustrated ideas faster comparing with texts. Nowadays, due to the benefits of diagrams, various of services are created to serve the pur- pose of creating diagrams with diverse types and a wide range of supported platforms such as web, desktop, and mobile. One of the most popular is the Lucidchart website, draw.io website, DrawExpress Diagram Lite for android, etc.