Detecting Design Patterns in UML Class Diagram Images using Deep Learning

Detecting software design pattern is an important part of software reverse engineering because design patterns can provide the most intuitive design idea of software products, which can be useful for maintenance engineers. In past studies, a lot of approaches have been proposed to detect design patterns, and the machine learning-based approach is a new trend in recent years. In this paper, we propose a preliminary idea of a deep learning-based approach to detect design patterns from UML class diagrams of software products, which can be used in some cases that traditional approaches may not work. We propose an overall process, which is divided into preparation phase and application phase. In preparation phase, we train a deep learning-based classifier to do the image classification task. In application phase, users may input the UML class diagram of a micro-architecture into the model and get the pattern it belongs to. We conduct a preliminary experiment to show the effectiveness of our approach, we train a Convolutional Neural Network (CNN) as the classifier and test it on our image dataset, which is constructed with UML images we collected from the Internet. We also use Gradient-weighted Class Activation Mapping (Grad-CAM) to do the visualization and use it to explain why our approach works. Lastly, we analyze the potential advantages and disadvantages of our approach.

[1]  Roy Oberhauser,et al.  A Machine Learning Approach Towards Automatic Software Design Pattern Recognition Across Multiple Programming Languages , 2020 .

[2]  Taghi M. Khoshgoftaar,et al.  A survey on Image Data Augmentation for Deep Learning , 2019, Journal of Big Data.

[3]  Jordan J. Bird,et al.  A Study on CNN Transfer Learning for Image Classification , 2018, UKCI.

[4]  Abhishek Das,et al.  Grad-CAM: Visual Explanations from Deep Networks via Gradient-Based Localization , 2016, 2017 IEEE International Conference on Computer Vision (ICCV).

[5]  Beniamino Di Martino,et al.  A rule‐based procedure for automatic recognition of design patterns in UML diagrams , 2016, Softw. Pract. Exp..

[6]  Jian Sun,et al.  Deep Residual Learning for Image Recognition , 2015, 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR).

[7]  Keiron O'Shea,et al.  An Introduction to Convolutional Neural Networks , 2015, ArXiv.

[8]  Wiwat Vatanawood,et al.  Detection of design pattern in class diagram using ontology , 2014, 2014 International Computer Science and Engineering Conference (ICSEC).

[9]  Hironori Washizaki,et al.  Detecting Design Patterns in Object-Oriented Program Source Code by Using Metrics and Machine Learning , 2014 .

[10]  Alexander Chatzigeorgiou,et al.  Design Pattern Detection Using Similarity Scoring , 2006, IEEE Transactions on Software Engineering.

[11]  Alan Bundy,et al.  Automatic verification of design patterns in Java , 2005, ASE.

[12]  Cornelia Boldyreff,et al.  A Method to Recover Design Patterns Using Software Product Metrics , 2000, ICSR.

[13]  M. Gogolla Unified Modeling Language , 2009, Encyclopedia of Database Systems.

[14]  Yann-Gaël Guéhéneuc,et al.  P-MARt : Pattern-like Micro Architecture Repository , 2007 .

[15]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[16]  Gavriel Salomon,et al.  T RANSFER OF LEARNING , 1992 .