Full text
University of Minho School of Engineering Diogo de Oliveira Campos Tavares Visualizing Neural Network Architectures october 2023
University of Minho School of Engineering Diogo de Oliveira Campos Tavares Visualizing Neural Network Architectures Master’s Dissertation Master in Informatics Engineering Dissertation supervised by Antonio José Borba Ramires Fernandes october 2023
Copyright and Terms of Use for Third Party Work This dissertation reports on academic work that can be used by third parties as long as the internationally accepted standards and good practices are respected concerning copyright and related rights. This work can thereafter be used under the terms established in the license below. Readers needing authorization conditions not provided for in the indicated licensing should contact the author through the RepositóriUM of the University of Minho. License granted to users of this work: CC BY https://creativecommons.org/licenses/by/4.0/ i
Acknowledgements I would like to thank my parents, who always supported me and made this academic journey possible. To all my friends and course-mates, who in one way or another helped me on this long journey and helped me create memories that will forever be kept in my heart. To my supervisor, who was always present, available and helped me at every stage since the beginning of this journey. I would like to also acknowledge the assistance of ChatGPT, an AI language model developed by OpenAI, in the writing process of this article to improve fluency as a foreign writer. While ChatGPT provided valuable insights and suggestions during the creation of the content, it is essential to clarify that all the final decisions regarding the thesis’s content and results are entirely my responsibility. ChatGPT’s contribution served as a helpful tool to enhance language proficiency, but I take full ownership of the final product and its accuracy. And to all those who, in some way, participated in carrying out this work. Thank you all ii
Statement of Integrity I hereby declare having conducted this academic work with integrity. I confirm that I have not used plagiarism or any form of undue use of information or falsification of results along the process leading to its elaboration. I further declare that I have fully acknowledged the Code of Ethical Conduct of the University of Minho. University of Minho, Braga, october 2023 Diogo de Oliveira Campos Tavares iii
Abstract In the constantly evolving realms of Deep Learning and Machine Learning, the ascent of intricate and powerful neural network models has pushed the frontiers of computational intelligence to new heights. Nevertheless, the conspicuous absence of an accessible and user-friendly visualization tool has presented an imposing hurdle in the endeavor to comprehend and dissect these intricate and multifaceted architectures. In direct response to this critical challenge, this dissertation unveils a network visualizer platform: Neural Network Explorer. this platform has been developed in an attempt to offer a comprehensive solution to these complex problems. Through an exhaustive and in-depth analysis of existing tools and APIs, the Neural Network Explorer platform provides a streamlined and intuitive methodology for visualizing a diverse and extensive array of neural networks. This innovative tool empowers users to seamlessly unravel and decode the intricacies of the various layers and structures that compose these intricate model architectures, thereby fostering a deeper and more insightful understanding of the fundamental mechanisms that govern their functioning. By delving into the realm of cutting-edge network visualization techniques, the platform not only facilitates the seamless export of illustrative images but also grants access to a wealth of detailed and layer-specific information. This abundant and comprehensive data resource acts as a dynamic catalyst for researchers and developers, equipping them with the essential insights and understanding needed to adeptly navigate the landscape of deep learning models and harness the potential within. Through its robust exploration and innovative methodologies, this work provides researchers and practitioners with an indispensable and user-friendly tool for unraveling and exploring the complex and architectures that underscore the foundation of advanced computational intelligence. Keywords Machine learning, Deep Learning, visualization. iv
Resumo Nos domínios em constante evolução do Deep Learning e Machine Learning , a ascensão de modelos de redes neuronais e poderosos impulsionou os limites da inteligência computacional a novas alturas. No entanto, a ausência notória de uma ferramenta de visualização acessível e fácil de usar tem representado um obstáculo imponente na busca por compreender e desvendar essas arquiteturas complexas e multifacetadas. Em resposta direta a este desafio crítico, esta dissertação revela com orgulho a plataforma Neural Network Explorer, elaborada para preencher essa lacuna e oferecer uma solução abrangente para esses problemas complexos. Através de uma análise exaustiva e aprofundada das ferramentas e APIs existentes, a plataforma Neural Network Explorer oferece uma metodologia simplificada e intuitiva para visualizar uma gama diversificada e extensa de redes neurais. Esta ferramenta inovadora capacita os utilizadores a desvendar e decifrar sem esforço as complexidades das várias camadas e estruturas que compõem essas arquiteturas de modelos, promovendo assim uma compreensão mais profunda e perspicaz dos mecanismos fundamentais que regem o seu funcionamento. Através da exploração de técnicas de visualização de redes de ponta, a plataforma não só facilita a exportação imediata de imagens ilustrativas, mas também proporciona acesso a um conjunto de informações detalhadas e específicas de layers . Este recurso de dados abrangente e abundante atua como um catalisador dinâmico para investigadores e desenvolvedores, dotando-os dos conhecimentos e compreensão essenciais necessários para navegar habilmente pela paisagem dos modelos de aprendizagem profunda e aproveitar o seu potencial. Através da sua exploração robusta e metodologias inovadoras, este trabalho marca um marco fundamental no campo da visualização de redes neurais, fornecendo aos investigadores e profissionais uma ferramenta indispensável e fácil de usar para desvendar e explorar as arquiteturas complexas que sustentam a base da inteligência computacional avançada. Palavras-chave Machine learning, Deep Learning, visualization. v
Contents I Introductory material 1 1 Introduction 2 1.1 Context and Motivation ................................ 2 1.2 Objectives ...................................... 3 1.3 Document structure .................................. 3 2 State of the Art 5 2.1 Neural Networks ................................... 5 2.1.1 Fully-connected Neural Networks ....................... 6 2.1.2 Convolutional Neural Networks ........................ 8 2.1.3 Recurrent Neural Networks .......................... 13 2.1.4 Long Short-Term Memory Networks ...................... 15 2.1.5 Gated Recurrent Unit Networks ........................ 16 2.1.6 Transformers ................................. 18 2.1.7 Generative Adversarial Networks ....................... 20 2.1.8 Autoencoders ................................ 22 2.2 Existing Tools For Architecture Visualization ...................... 23 2.2.1 TensorBoard ................................. 24 2.2.2 Keras Visualizer ............................... 25 2.2.3 Keras Plot .................................. 27 2.2.4 Visualkeras .................................. 28 2.2.5 Summary .................................. 29 vi
Acronyms CNN Convolutional Neural Network. 2,8,9,10,11,12,29 CSS Cascading Style Sheets. 34 FNN Fully-connected neural network. 6,13,29 GAN Generative Adversarial Network. 20,21,22 GRU Gated Recurrent Unit. 15,16,17,18 HTML Hyper Text Markup Language. 34 HTTP Hyper Text Transfer Protocol. 34 JSON JavaScript Object Notation. 39,42,49,53,61,62 LSTM Long Short-Term Memory. 15,16,17 NN Explorer Neural Network Explorer. iv,v,3,4,32,37,50,51,52,53,54,55,58,60,61,62,64 RNN Recurrent Neural Network. 13,14,15,16,17,18,19 xiii
Part I Introductory material 1
Chapter 1 Introduction 1.1 Context and Motivation The realm of neural networks has experienced a relatively recent surge in interest, particularly following the introduction of the ImageNet Large Scale Visual Recognition Challenge (ILSVRC) in 2010 by Deng et al. [2009]. This pivotal event aimed to identify the most accurate network for automatic photo retrieval and annotation, utilizing a subset of the extensively labeled ImageNet dataset for training. However, discussions regarding this topic have a longer history, dating back to the introduction of the LeNet5 network in 1994 by Lecun et al. [1998], considered one of the pioneering Convolutional Neural Network. Despite the gradual progress of these networks between 1998 and 2010, advancements were relatively slow, primarily due to limitations in hardware capabilities and available information during that period. As indicated by Culurciello [2017], the evolution of this field was facilitated by the integration of cameras into smartphones and affordable digital cameras, coupled with the development of faster CPUs and the widespread adoption of GPUs for computational purposes. The field witnessed a notable upsurge in progress after 2010, marked by the emergence of the Dan Ciresan Network, the first network implemented on a GPU, as presented by Ciresan et al. [2010]. Subsequently, the AlexNet network, introduced by Alex Krizhevsky [2012], achieved victory in the ImageNet competition in 2012. This groundbreaking network, a deeper and broader version of the LeNet network, served as a catalyst for the subsequent introduction of the VGG network by Simonyan and Zisserman [2015], notable for pioneering the use of 3x3 filters in each convolutional layer. The GoggLeNet, unveiled by Szegedy et al. [2014], marked the first of several versions of the Inception Network, characterized by its innovative use of parallel combinations of 1x1, 3x3, and 5x5 convolutional filters. The year 2015 witnessed the introduction of various networks, including two iterations of the Inception network and the ResNet network. In particular, the Inception V2, incorporating Batch-Normalization, was introduced by Ioffe and Szegedy [2015], while the ResNet and Inception V3 networks were presented 2
almost simultaneously towards the end of 2015, as documented by He et al. [2015] and Szegedy et al. [2015], respectively. These evolutionary strides in network development have fostered significant breakthroughs across multiple domains and tasks, including image classification, object detection, natural language processing (NLP), sentiment analysis, speech recognition, generative adversarial networks (GANs), and reinforcement learning. Despite these advancements, the increasing complexity and scale of neural networks have posed challenges in understanding their mechanisms and decision-making processes. Visualizing their architectures and various features has emerged as a crucial avenue for comprehending their inner workings and enhancing interpretability. 1.2 Objectives The primary objectives of this master’s dissertation revolve around the development of an advanced platform, Neural Network Explorer (NN Explorer), tailored to empower developers in visualizing Keras models. Specifically, the platform’s focus lies in seamlessly importing models, providing a comprehensive visualization of the network’s architecture, and delivering detailed layer-specific information for enhanced understanding. Furthermore, the platform is designed to enable users to effortlessly export high-quality representations of the neural network. This feature facilitates the seamless integration of visualizations into a variety of contexts, including academic research papers, articles, and presentations. By fulfilling these core objectives, the platform strives to enhance the accessibility and usability of neural network visualization. It aims to facilitate efficient communication of research findings, empowering researchers and developers in the fields of Deep Learning and Machine Learning to effectively convey complex concepts through the creation of sophisticated, easily interpretable visual representations of their neural networks. 1.3 Document structure This dissertation is split into six different chapters. In chapter 1 is introduced the theme of the dissertation, starting with a brief contextualization, followed by the motivation and finally the objectives. In chapter 2 we focused on the state of the art of neural networks, network visualization tools, and 3
tools used. In chapter 3 and chapter 4 is presented the various steps and stages of the developed tool, NN Explorer. In chapter 5 is shown some comparisons between the developed platform and existing tools/APIs that promise to do the same job. Finally, the document ends with chapter 6 in which the main conclusions drawn, as well as potential future developments are presented. 4
Chapter 2 State of the Art In the upcoming sections, we will explore neural networks and visualization tools, which are crucial topics for this dissertation. In the following section 2.1, we will provide a comprehensive overview of different types of neural networks and their architectural details. We will delve into the framework of these networks, exploring their structures and applications. At the same time, our exploration of network visualization tools begins in section 2.2. Here, we will carefully analyze and explore the existing tools used to clarify network architectures and related information. 2.1 Neural Networks Neural networks have evolved from fully connected networks to more complex architectures with the introduction of many different layers. This section explores some of the most relevant architectures, focusing on the layers introduced in these architectures and common options of the architectures. This section assumes that the reader is familiar with neural networks, and with that in mind the basic concepts about them will not be described. For an introduction to deep learning see Chollet [2017]. In this section will be presented some of the most used architectures: • Fully-connected Neural Networks, subsection 2.1.1 • Convolutional Neural Networks, subsection 2.1.2 • Recurrent Neural Networks, subsection 2.1.3 • Long Short-Term Memory Networks, subsection 2.1.4 • Gated Recurrent Unit Networks, subsection 2.1.5 • Transformers, subsection 2.1.6 5
• Generative Adversarial Networks, subsection 2.1.7 • autoencoders, subsection 2.1.8 2.1.1 Fully-connected Neural Networks Fully-connected neural network (FNN), are a fundamental and the most basic type of neural networks. They are widely used as part of the solution of various problems due to their simplicity and effectiveness (Bebis and Georgiopoulos [1994]). At its core, a fully-connected neural network consists of multiple layers structured in a sequential manner, with each layer receiving inputs from the previous layer and passing its outputs to the next layer. The term ”fully-connected” derives its name from the fundamental concept that every neuron within a particular layer establishes a connection with each neuron in both the preceding and succeeding layers. These networks primarily comprise two fundamental types of layers: Dense (or fully-connected) layers and Dropout layers. It’s worth noting that the usage of Dropout layers is not a ubiquitous practice and may not always be incorporated into the network architecture. Dense Layers Dense layers, also known as fully-connected layers, were introduced with Sanger and Baljekar [1958], in the early days of neural networks and artificial intelligence, and are a fundamental component in artificial neural networks, particularly in deep learning. In this layer, each neuron establishes connections with every neuron in the preceding layer and every neuron in the subsequent layer (if present), as shown in Figure 1. The comprehensive interconnection enables information flow throughout the network (Huang et al. [2016]Verma [2023]). This arrangement results in complete inter-connectivity between adjacent layers, earning them the moniker ”fully connected layers”. 6
Figure 1: Representation of the Dense Layers 1 Dense layers are also prominently featured in the final layers of more complex neural networks for tasks such as classification, where the output layer’s dimensions correspond to the number of classes or categories to be predicted. Dropout Layer Dropout layers are a pivotal regularization technique in the realm of neural networks. These layers play a crucial role in mitigating over-fitting, improving generalization, and enhancing the robustness of deep learning models. Dropout is a regularization method employed during training to prevent neural networks from becoming overly specialized to the training data. It combats over-fitting by randomly ”dropping out” a subset of neurons during each training iteration. This dropout process effectively simulates training multiple networks with different architectures and, thus, enhances the model’s generalization capability (Özgür and Nar [2020]). 1https://pysource.com/2022/10/07/flatten-and-dense-layers-computer-vision-with-keras-p-6/ 7
Figure 2: Representation of the Dropout Layers 2 Within a Dropout layer, a predefined fraction of neurons is randomly selected and temporarily deactivated (set to zero) during each forward and backward pass in the training process. The fraction of neurons to be dropped out, referred to as the dropout rate, is a hyperparameter that can be adjusted based on the specific needs of the model(Labach et al. [2019]). Dropout layers have become a staple in the design of deep neural networks, particularly in tasks where large amounts of training data are scarce, or when the network architecture is complex. Their ability to prevent over-fitting and enhance model generalization has made them an invaluable tool in the deep learning practitioner’s toolkit (Masri [2019]). 2.1.2 Convolutional Neural Networks Convolutional Neural Network (CNN), pioneered by Lecun et al. [1998], represent a versatile family of functions with significant applicability in parameterizing models (Kamath et al. [2019]). They are a powerful class of deep learning models specifically designed for tasks that involve grid-like data, such as object detection, digit and image recognition, videos, and sequences (Ajit et al. [2020]). They have revolutionized the field of computer vision and achieved remarkable success in various other domains. Typically, these networks are structured around two key types of layers: convolutional layers and pooling layers, which form the core of the network for feature extraction and down-sampling. Additionally, 2https://towardsdatascience.com/an-intuitive-explanation-to-dropout-749c7fb5395c 8
it’s customary for such networks to culminate with a fully-connected part, providing the capacity for highlevel abstraction and decision-making. Convolutional Layer Convolutional layers, introduced by Lecun et al. [1998], derive their name from the convolution operation, a mathematical operation that is at the core of their functionality. The convolution operation involves sliding a small filter (also known as a kernel) over the input data, typically an image. The filter is applied to local regions of the input, and by varying the filter’s weights, CNN can learn to detect different features within the input data (DIC [2020]). One of the key innovations in convolutional layers is weight sharing. The same filter is applied across the entire input image, which significantly reduces the number of parameters in the network compared to a fully connected layer. This weight sharing not only reduces computational complexity but also enforces translation invariance, meaning the network can detect the same feature regardless of its position in the image (Wang et al. [2020]). Figure 3: Representation of the Convolutional Layers 3 3https://towardsdatascience.com/simple-introduction-to-convolutional-neural-networks-cdf8d3077bac 9
requiring an understanding of temporal context and long-range dependencies (Azzouni and Pujolle [2017]). LSTM, like RNN, are trained using backpropagation through time to update their parameters and learn from sequential data. The gating mechanisms facilitate a smoother flow of gradients during training, mitigating the vanishing and exploding gradient issues that plague traditional RNN. While LSTM provide significant advancements in capturing long-term dependencies, they are computationally more expensive than standard RNN. For certain applications where efficiency is a priority, simplified variants like Gated Recurrent Unit (GRU), that will be discussed in subsection 2.1.5, have gained popularity. Figure 10: LSTM Architecture 7 In conclusion, LSTM Networks, built on the foundation of RNN, have demonstrated their ability to capture long-term dependencies in sequential data. By incorporating memory cells with gating mechanisms, LSTM efficiently remember crucial context over extended sequences. They have become a fundamental tool in tasks requiring an understanding of temporal relationships and have propelled advancements in various fields, from natural language processing to speech recognition. 2.1.5 Gated Recurrent Unit Networks Gated Recurrent Unit (GRU) Networks are a variant of RNN designed to address the challenges of capturing long-term dependencies in sequential data while being computationally more efficient than traditional LSTM.GRU have gained popularity for their simplicity, effectiveness, and ability to model sequences 7https://databasecamp.de/en/ml/lstms 16
with extended time lags. Similar to LSTM,GRU have gating mechanisms that allow them to selectively retain and forget information over time steps, making them well-suited for tasks involving sequential data with long-range dependencies. However, compared to LSTM,GRU have a simplified architecture, using only two gates: the update gate and the reset gate, as seen in Figure 11 (Li et al. [2019]). The update gate in a GRU controls the flow of information from the previous hidden state to the current hidden state, determining how much of the previous state should be retained. The reset gate, on the other hand, decides what information from the current input and the previous hidden state should be forgotten. By utilizing these two gating mechanisms, GRU can efficiently capture relevant information over long sequences, while still being computationally lightweight. This efficiency makes GRU particularly attractive when dealing with large-scale datasets or real-time applications where computational resources are limited (Chung et al. [2015]). During training, GRU use backpropagation through time to update their parameters and learn from sequential data, similar to other types of recurrent neural networks. The gradients flow through the gates, allowing the network to address the vanishing and exploding gradient problems that can hinder learning in standard RNN (Liu et al. [2018], Williams and Peng [1990]). Despite their simplicity, GRU have demonstrated competitive performance across a wide range of sequence-related tasks, including natural language processing, speech recognition, and video analysis. They have been successfully employed in various applications, such as language translation, sentiment analysis, and anomaly detection in time series data (Chung et al. [2014], Chung et al. [2015]). One advantage of GRU is that they typically require fewer parameters than LSTM, which can lead to faster training times and reduced memory usage. This simplicity also makes GRU easier to implement and interpret, making them an attractive choice for researchers and practitioners in the deep learning community (Akandeh and Salem [2017], Rehmer and Kroll [2020]). 17
Figure 11: GRU Architecture 8 In summary, GRU Networks provide an effective and efficient solution for modeling sequential data with long-term dependencies. Their simplified architecture, incorporating update and reset gates, allows them to efficiently capture context in sequential data while offering competitive performance across various applications. 2.1.6 Transformers Transformers are a revolutionary class of deep learning models that transformed the field of natural language processing and made significant contributions to other tasks involving sequential data. This class of models was introduced by Ashish Vaswani in 2017, and they have become the backbone of many state-of-the-art language models (Vaswani et al. [2017]). Unlike traditional RNN and their variants, Transformers rely on self-attention mechanisms to capture dependencies between different elements in the input sequence. This allows them to process the entire sequence in parallel, eliminating the need for sequential computation and making them highly parallelizable, which leads to faster training times and improved efficiency. The key building blocks of Transformers are attention mechanisms. Self-attention enables each position in the sequence to attend to all other 8https://towardsdatascience.com/illustrated-guide-to-lstms-and-gru-s-a-step-by-step-explanation-44e9eb85bf21 18
positions, capturing global dependencies efficiently. Additionally, multi-head attention allows the model to attend to different positions from multiple representation subspaces, enhancing its ability to capture complex patterns (Tay et al. [2020], Khan et al. [2021]). The architecture of Transformers consists of an encoder and a decoder. In the context of natural language processing, the encoder processes the input sentence, generating a contextualized representation for each word. The decoder then utilizes this representation to generate the output sequence, making Transformers particularly effective in machine translation, language modeling, and text generation tasks (Wolf et al. [2019], Chen et al. [2021]). Transformers have gained popularity not only in natural language processing but also in computer vision and other domains. In vision tasks, such as object detection and image captioning, Transformers have demonstrated competitive performance by employing attention mechanisms to capture spatial relationships among image elements (Khan et al. [2021]). The success of Transformers can be attributed to their ability to model long-range dependencies effectively, their parallel processing capabilities, and their capacity to capture contextual information with self-attention. However, Transformers typically require more memory and computational resources than traditional RNN, making them more challenging to train on resource-constrained devices(Vaswani et al. [2017], Tay et al. [2020], Khan et al. [2021], Wolf et al. [2019], Chen et al. [2021]). 19
Figure 12: Transformer Architecture 9 In conclusion, Transformers have revolutionized the field of natural language processing and become a dominant force in many other sequential data tasks. With their attention mechanisms, they can effectively model long-range dependencies and capture complex patterns. Pre-trained Transformer models have further accelerated progress in transfer learning and achieved impressive results across various domains. As research on Transformers continues, we can expect further advancements and novel applications in the ever-evolving landscape of deep learning. 2.1.7 Generative Adversarial Networks Generative Adversarial Network (GAN) represent a powerful class of deep learning models that have revolutionized the field of generative modeling. GANs were introduced by Ian Goodfellow and his colleagues in 2014 and have since become a fundamental tool for generating realistic and high-quality synthetic data. The architecture of a GAN model consists of two neural networks that are trained simultaneously: the generator and the discriminator. The generator is responsible for creating synthetic data samples, while the discriminator’s task is to distinguish between real data and the generated data. The training process 9https://d2l.ai/chapter_attention-mechanisms-and-transformers/transformer.html 20
involves a competitive interplay between these two networks, leading to the term ”adversarial” (Creswell et al. [2017], Goodfellow et al. [2014]). During training, the generator aims to generate samples that are indistinguishable from real data, while the discriminator tries to correctly classify real and fake samples. As training progresses, the generator becomes more adept at generating realistic data, and the discriminator improves at distinguishing real from generated data. The training of GAN models is often described as a min-max game, where the generator seeks to minimize the probability of the discriminator correctly classifying fake samples, while the discriminator aims to maximize its accuracy in distinguishing between real and fake samples. This competitive process drives the generator to produce more realistic outputs over time (Goodfellow et al. [2020], Liang et al. [2018]). GANs have found applications in various creative domains, such as image synthesis (Radford et al. [2015], Karras et al. [2017]), language modeling (Li et al. [2017]), and video generation (Nakahira and Kawamoto [2018]). They have also been employed in data augmentation, improving the performance of machine learning models by generating additional training samples. One of the main challenges in training GANs is achieving stability. The balance between the generator and discriminator can be delicate, and GANs are known to be sensitive to hyperparameter choices. Researchers have proposed various techniques to enhance the stability of GAN training, such as Wasserstein GAN (WGANs) and Progressive GAN (Chen [2021], Arjovsky et al. [2017], Karras et al. [2017]). Despite their complexity and challenges, GANs have produced impressive results, generating realistic image generation (Brock et al. [2018], Karras et al. [2017]), video frame generation (Vondrick et al. [2016]), and even artistic style migration (Chang et al. [2018]). Their ability to learn intricate patterns and generate new data has made them a key technology in the realm of artificial intelligence and creative applications. Figure 13: GAN Architecture 10 21
In conclusion, GANs have emerged as a groundbreaking approach for generative modeling. By opposing a generator against a discriminator in an adversarial setup, GANs can learn to produce realistic and high-quality synthetic data. Their potential applications are vast, from creative content generation to data augmentation, and they continue to be an active area of research in the deep learning community. 2.1.8 Autoencoders Autoencoders are a class of artificial neural networks used for unsupervised learning and dimensionality reduction tasks. They have a unique architecture that allows them to encode the input data into a lowerdimensional representation and then decode it back to its original form, effectively reconstructing the input (Bank et al. [2020]). The architecture of an autoencoder typically consists of an encoder and a decoder. The encoder compresses the input data into a latent space representation, also known as a bottleneck layer. This compressed representation captures the most salient features of the input data while reducing its dimensionality. The decoder, on the other hand, takes the compressed representation and reconstructs the original input data from it. The objective of an autoencoder is to minimize the reconstruction error, i.e., the difference between the original input and the output of the decoder (Dertat [2017], Zhang et al. [2022]). Autoencoders are trained using backpropagation and an optimization algorithm, such as stochastic gradient descent. During training, the network learns to extract meaningful features from the input data, effectively learning a compressed representation that can be used for various purposes, including data compression, denoising, and anomaly detection (Li and Yan [2022], Daoud and Mayo [2018], Andayani et al. [2017]). One of the key applications of autoencoders is in dimensionality reduction. By learning a compact representation of the data, autoencoders can be used to efficiently store and transmit information while preserving important features. This makes them useful in scenarios with limited storage or bandwidth (Hu et al. [2014], Wang et al. [2012], Nixon et al. [2020]). Another application of autoencoders is anomaly detection. Since autoencoders learn to reconstruct normal data patterns, they can be used to detect anomalies by measuring the difference between the reconstruction and the original data. Anomalies are typically characterized by higher reconstruction errors, making them stand out from the normal data (Sakurada and Yairi [2014], Pyatnisky and Sokolov [2020]). Variational Autoencoders (VAEs) are a popular extension of autoencoders that add a probabilistic twist to the encoding process. VAEs learn to model the distribution of the latent space, enabling them to 10 https://developers.google.com/machine-learning/gan/gan_structure 22
generate new data samples from the learned distribution. This property makes VAEs particularly attractive for generative modeling tasks (Kingma and Welling [2019], Wei et al. [2020]). Figure 14: Autoencoder Architecture 11 In conclusion, Autoencoders are versatile neural networks that can learn compressed representations of input data and reconstruct it back to its original form. They find applications in several topics like dimensionality reduction or anomaly detection. Variational Autoencoders further extend their capabilities to generative modeling. Autoencoders continue to be a valuable tool in unsupervised learning and have demonstrated their effectiveness in various real-world applications. 2.2 Existing Tools For Architecture Visualization As presented in section 2.1 the architecture varies greatly depending on the type of model. Furthermore, within each type there are also significant variations. Being able to visualize graphically the architecture of a given model can potentially help to understand its features. For this overview the following visualization tools/APIs were considered: • TensorBoard, subsection 2.2.1 • Keras Visualizer, subsection 2.2.2 • Keras Plot, subsection 2.2.3 • Visualkeras, subsection 2.2.4 11 https://machinelearningmastery.com/pooling-layers-for-convolutional-neural-networks/ 23
2.2.1 TensorBoard TensorBoard, a tool from TensorFlow, assists researchers and machine learning practitioners by offering a web-based interface for model understanding, debugging, and optimization. It utilizes log files from training or evaluation to provide various functionalities, allowing users to explore and analyze the machine learning process (Wycliffe [2023]). TensorBoard helps visualize and track key metrics like loss and accuracy, offering insights into model performance. It also presents model graphs with operations and layers, helping users understand their model’s architecture (Wycliffe [2023])12. TensorBoard additionally offers histograms to inspect parameter distributions. However, its information presentation can be overwhelming for users at times. While TensorBoard is a good solution for visualizing neural networks, it has limitations in visualizing and exporting network architecture, especially in terms of customization. It provides a high-level overview but lacks detailed information about each layer, limiting fine-grained analysis (Figure 15). Figure 15: Example of visualization of network with use of TensorBoard 12 https://www.tensorflow.org/tensorboard 24
In summary, TensorBoard stands as an asset for researchers and practitioners alike, empowering them to gain critical insights, identify potential pitfalls, and refine their machine learning models. However, it is essential to recognize its complexity and the need for further enhancements to customize and enrich the visualization of network architectures, thereby bolstering the depth of analysis and understanding in the pursuit of cutting-edge research and innovation. 2.2.2 Keras Visualizer The Keras Visualizer is an open-source Python library developed by RedaOps, providing a range of functionalities for visualizing Artificial Neural Networks (ANNs). It’s aimed at researchers, developers, and machine learning practitioners looking to gain insights into their neural network models (RedaOps [2018]). The primary feature of the Keras Visualizer is its capacity to display the architecture of artificial neural networks. It offers a view of network layers, units, and connections, enhancing comprehension of the model’s structure (Shah [2018]). The Keras Visualizer is designed to integrate smoothly with Keras models, a widely used deep learning framework. It uses Python’s graphviz library to create the network architecture graphs. This integration simplifies the visualization of complex model structures, providing some information about layers, connections, and information flow. The visually graphs aid in intuitive comprehension, enabling informed decisions about model design and optimization. The resulting graph showcases the hierarchical arrangement of layers and their interconnections, making it good for debugging and optimization (Shah [2018], RedaOps [2018], Dar [2018]). Similar to TensorBoard, the API has limitations in layer customization. It provides basic layer information, such as layer type and the number of filters. In some cases, like convolutional layers, it may offer additional details like kernel size, as seen in Figure 16. 25
Chapter 3 Architecture To pave the way for the creation of this dissertation, the initial step involved the delineation of the objectives and a comprehensive requirement analysis aimed at addressing the inquiries outlined in the concluding section of the previous chapter (chapter 2). This process yielded a set of imperative prerequisites, which will expound upon shortly. Furthermore, the intricate architecture of both the front-end and back-end servers will also be elucidated in the ensuing sections. 3.1 Objectives This dissertation is primarily focused on the creation of a comprehensive platform, NN Explorer, designed to visualize the intricate architectures of neural networks. Through a meticulous examination of existing tools dedicated to neural network visualization (as discussed in section 2.2), we have identified both their strengths and limitations, which serve as a foundation for delineating the essential features and capabilities that should be incorporated into the platform under development. With this overarching objective in mind, we have outlined the following specific goals and objectives for this dissertation: •Versatility: The platform should possess the capability to seamlessly accommodate a wide array of network architectures. It is essential that it can adapt to and effectively visualize the various architectural complexities that may be encountered in neural networks. •Comprehensive Layer Support and extensibility: To enhance its utility, the platform must be proficient in handling an extensive range of layer types. The ability to visualize different layer types, including novel and evolving ones, is crucial for its relevance in the ever-evolving field of neural networks. Beyond this the platform should exhibit a high degree of extensibility, allowing for the effortless integration of new layer types. This adaptability ensures that the platform remains at the 32
forefront of innovation, accommodating emerging neural network paradigms with ease. •Customizability: Recognizing that users often have specific requirements and preferences, the platform should offer a high degree of customizability. This means that users should have the flexibility to tailor the visualization experience to their unique needs and preferences. •Enhanced Network Overview: In addition to its core capabilities, the platform should incorporate the ability to group layers into coherent blocks, providing users with a more comprehensive and insightful overview of the network’s structure. 3.2 Platform Architecture In this section, both the requirements and the architecture of the platform will be presented. The requirements encompass both the functional and non-functional facets, shaping a comprehensive framework for the platform’s development and operation. 3.2.1 Functional Requirements The functional requirements of the platform are presented next: • Seamless user experience is paramount, thus, it is imperative to empower users with the capability to effortlessly integrate any Keras model, regardless of whether it resides as a .k5 file or within a designated directory. • Facilitating an insightful comprehension of the model’s architecture is a pivotal feature. This encompasses a comprehensive visualization of its intricate layers, along with pertinent and pivotal information. This offering caters to a dual audience: developers crafting Keras models who require affirmation of their architecture, and researchers seeking insights into the models they employ or need to elucidate. • Export an image of the model’s architecture. This image is a representation of the complete model. If there are blocks defined in the model they are represented in the main model image, and an image of the blocks interior is also exported. • Empower users with the capacity to tailor the depiction of the architecture, with a specific focus on enhancing the representation of layers. 33
3.2.2 Non-Functional Requirements •Usability: While the anticipated users of the platform possess ample expertise to construct systems akin to this, it remains imperative for the platform to boast a user-friendly and instinctive interface, accommodating diverse user profiles. Consequently, the functionalities should inherently be selfexplanatory, catering to users with varying levels of familiarity and technical background. •Portability: The platform’s accessibility should span across various available web browsers, and its behavior must consistently mirror across this diverse browser landscape. 3.2.3 Front-end Server The front-end of the platform is the part where the final user interacts with it. This part of the platform is composed by three elements: Figure 19: Front-end architecture •Hyper Text Markup Language (HTML) code: definition of the visual components; •Cascading Style Sheets (CSS) code: style of the visual components defined by HTML; •JavaScript code: defines the logic and behavior of the interactions with the components; Communication with the back-end is seamlessly orchestrated via the front-end, utilizing the Hyper Text Transfer Protocol (HTTP) requests facilitated by the Flask framework. 34
3.2.4 Back-end Server Figure 20: Platform Architecture The back-end component of our platform serves as the engine that powers the functionality and interactivity of the entire system. It is a crucial part of our platform’s architecture, responsible for managing the communication between the user interface and the machine learning model sent and its information. The back-end is primarily composed of two key components: a Python and a JavaScript script. Figure 21: Back-end interactions 35
Python The Python back-end plays a pivotal role in the platform’s operation. Its primary responsibilities include receiving, processing, and disseminating information related to the machine learning models sent by the user to the platform. To accomplish this, we employ the Flask web framework, a lightweight and versatile tool for building web applications. The Flask framework facilitates the creation of robust and scalable APIs, which serve as the backbone for our platform’s functionality. One of the core functions of the Python back-end is to receive machine learning models submitted by users and retrieve all the essential information to represent it and show to the user. In this essential information is included, the different layers and their types, their connections with the other layers, the size of the layers, activation, and much more. Additionally, the Python back-end is responsible for enhancing the user experience by adding a legend to the exported visual representation of the machine learning models. JavaScript The JavaScript front-end component of our platform serves as the user’s primary interface for interacting with the system. It is responsible for presenting the machine learning models and their associated information to the user in an intuitive and user-friendly manner. The JavaScript front-end communicates seamlessly with the Python to retrieve and display the relevant data. One of the key functions of this component is to facilitate user interactions. It provides a responsive and interactive environment that allows users to explore and analyze the machine learning models effectively. Users can interact with visual representations of the models and receive real-time updates as they adjust parameters of their visualization. This component not only facilitates the creation and export of the image of the model but also handles the visualization of blocks within the model. When a model contains defined blocks, the system ensures that they are drawn and exported as separate images. In practical terms, if a model includes two blocks, the platform exports three distinct images: one depicting the main model with the blocks presented in a compressed form, and two additional images, each representing the inner layers of one of the blocks. It is also possible to export all the information in one unique PDF file containing all the images and information of the layers. This approach provides users with a comprehensive visual representation of both the main model and its constituent blocks. 36
3.3 Summary In this chapter, we embarked on a comprehensive exploration of the multifaceted landscape that defines our platform, NN Explorer. This journey begins with a dissection of the functional and non-functional requirements, where we scrutinize the essential components that will ultimately shape the platform’s capabilities. Subsequently, we delve deep into the very heart of the platform, dissecting and illuminating its architectural intricacies. With an overview, we uncover the underlying structure, elucidating the systems and components that form the backbone of this platform. 37
Chapter 4 Neural Network Explorer Features and Usage In this chapter, we delve into the intricacies of the implementation process, shedding light on the decisions and steps taken to bring the project to its final, tangible form. The full implementation code can be found in GitHub1. The decision to name the platform ”Neural Network Explorer” rather than ”Neural Network Visualizer” was based on the broader functionality it offers. In addition to visualization, the platform facilitates exploration and interaction with the model, enabling users to delve deeper into the network’s intricacies and characteristics. 4.1 Model Reading For model reading, our platform currently supports Keras models, with plans to introduce PyTorch support in a future update. These Keras models can be provided in either of two formats: as a standalone .h5 file or as a folder created using the model.save('saved_model/my_model') method. In the case of the folder, it should be enclosed within a zip file with the same name. To commence the model reading process, users should select the file they wish to use by utilizing the ”Choose Model File” button, visually represented in Figure 22. Subsequently, after selecting the model, it is transferred to the Python server through the Flask framework. It’s crucial to confirm that the Python server is operational before proceeding with this operation. 1https://github.com/diogotava/Neural-Network-Explorer 38
(a) Before Selecting a model (b) Selected .h5 model file (c) Selected .zip model file Figure 22: Demonstration of how to select and upload a model Within the Python server, the load_model('your_model') function takes center stage as it loads the specified model into the environment. Following this loading process, a systematic traversal through each layer ensues, extracting essential information from each one. It’s important to highlight that models can be nested within other models, and this nesting is detected by examining whether a layer contains inner layers. The presence of inner layers within a particular layer serves as an indicator that the layer itself functions as a model. Regarding code classes, the system simplifies its architecture by employing just two primary classes: Layer and Block. This choice is motivated by the pragmatic handling of responses in JavaScript Object Notation (JSON) format transmitted from Flask to JavaScript. A more extensive hierarchy of child classes for Layer would introduce complexity through intricate conditional statements. In contrast, utilizing just these two classes streamlines the process, enabling the straightforward iteration through layers to gather necessary information. This design not only optimizes performance but also enhances the platform’s maintainability and potential for expansion. 4.2 Visualization For visualization, the choice of the p5.js framework simplifies the creation and interaction with scenes. The p5.js framework, though relatively recent, offers a wide range of capabilities, including the creation of diverse shapes and objects, dynamic scene movement, and even the incorporation of lighting effects. To facilitate scene navigation, the utilization of the orbitControl() function is invaluable. This eliminates the need for calculations to manipulate the camera, enhancing the user’s experience. Each layer is drawn twice, once in the visualization plane for user interaction and again in the picking plane. In the picking plane, layers are assigned unique colors based on their IDs, often represented as ((id >> 16) & 0xFF, (id >> 8) & 0xFF, id & 0xFF). This color scheme streamlines identification within the code, making it easy to track which layer the user has selected. 39
To select a layer, users only need to hover over it and click the ’C’ key. This results in the presentation of a board with information related to the selected layer, such as the Figure 23 illustrates. This information when active will follow the layer when the position is changed. Figure 23: Layer information The platform offers three distinct methods for visualizing the layers of a model: •Exponential Size: this method, the default one, employs exponential calculation to progressively reduce the size of the layers, creating a gradual reduction in their dimensions while preserving their relative proportions, Figure 24a. •Real Size: Here, the layers are displayed at their actual sizes, maintaining the precise dimensions of each layer as they were defined in the model, Figure 24b. •Linear Size: In this approach, a uniform size is assigned to every layer. The dimensions chosen are the minimum values for both length and width, ensuring that all layers share identical sizes, Figure 24c. 40
(a) Model visualized with exponential size (b) Model visualized with real size (c) Model visualized with linear size Figure 24: Visualization size options 4.2.1 Layer Positioning The precise positioning of layers is calculated within the JavaScript script, with a method that ensures accuracy in customization and simplifies the computation. The initial approach to position the layers started with a simple method, placing each subsequent layer in front of the previous one with a specific spacing. This approach worked well until different size options were introduced, which added complexity to the process. The challenge arose from the necessity of recalculating the size of each layer every time, considering the potential selection of a different size option during the next drawing iteration. The introduction of skip connections posed a new challenge, requiring the lateral shifting of layers to ensure the visibility of the two possible paths in the model. Concurrently, the introduction of branching presented similar challenges as it necessitated the positioning of multiple branches side by side, a requirement that skip connections did not impose. To address these challenges, the approach relied on the utilization of predecessor and successor layers, taking into account their quantity and arrangement. When the calculation encountered a layer with multiple successor layers, indicating either the presence of skip connections or multiple branches, all the successor layers were positioned side by side after the common previous layer, incorporating specific lateral spacing between them. This was conducted while considering the total lateral space that all the branches would occupy. This method catered to the possibility of having multiple branches within a single branch, as exemplified in Figure 25, which shows part of the inception v3 network. Subsequently, the calculation 41
To optimize the export process and ensure that the entirety of the model is captured with ease, the platform employs an orthographic camera for generating the image. The use of an orthographic camera is advantageous as it eliminates perspective distortion, enabling the exported image to faithfully represent the neural network’s spatial arrangement. This orthographic projection ensures that every layer and connection within the model is accurately depicted in the exported image. With the ability to have blocks in the platform, our platform needs to export them also. With this in mind when a neural network comprises blocks of layers, each block is exported as a separate image. This approach enhances the granularity of exported visualizations, allowing users to delve into the details of inner layers within each block. After previewing the images the user can export the image, and obtain images like the ones presented in Figure 29 and Figure 30, or cancel the process to modify the visualization for a better image export. Figure 29: Image of model with block 48
Figure 30: Image of inner layers of the model block The export functionality not only generates individual images but also produces a corresponding JSON file for each image. These JSON files contain comprehensive information pertaining to the layers included within the respective images. In addition to this, users have the option to export a comprehensive PDF document that consolidates all the images and information related to the model layers. This consolidated PDF document provides users with a convenient and unified overview of the entire model architecture, eliminating the need to manage separate files for each image or JSON file containing layer information. 49
Chapter 5 Analysis of results In this chapter, the dissertation presents the culmination of its efforts, unveiling the results achieved throughout the course of the development. This includes a comprehensive comparison between the existing tools/APIs and the novel framework developed in this dissertation. The comparative analysis aims to provide an insightful evaluation of the capabilities, performance, and distinct advantages offered by the newly developed platform, NN Explorer, in contrast to its established counterparts. 5.1 Comparison between existing tools/APIs In conducting an in-depth analysis and comparison among the existing tools/APIs highlighted in section 2.2, various critical aspects were thoroughly evaluated. This comprehensive assessment encompassed a comparative study of the visualization capabilities, the exported layer information, and several other key factors including customizability and extensibility. The objective is to provide a comprehensive understanding of how the newly developed tool, NN Explorer, measures up against its established counterparts, shedding light on its unique strengths and potential advantages. Recapping, the existing tools/APIs include: • TensorBoard 1 • Keras Visualizer • Keras Plot • Visualkeras To facilitate a comprehensive comparison between the developed platform and the various APIs, a series of custom models were employed. These models were carefully designed to include common 1Will not be compared due to being too limited in terms of visualizing the architecture 50
layers, such as those elucidated in section 2.1. Furthermore, the custom models integrated specially created layers that were specifically devised to rigorously assess and test the extensibility and capabilities of the respective APIs under examination. This methodical approach aims to provide a thorough evaluation of the overall performance and efficacy of the NN Explorer in comparison to the existing tools/APIs across a diverse range of scenarios and use cases. 5.1.1 Single Branch network For this test, was used a model with only one branch, with some of the most common layers in neural networks. In this case the model is composed by two Conv2D layers, followed by a MaxPooling2D a Flatten and a Dense layer. (a) Single branch model architecture with VisualKeras (b) Single branch model architecture with KerasPlot 51
Figure 32: Single branch model architecture with Keras Visualizer2 Figure 33: Single branch model architecture with Neural Network Explorer Image generated The NN Explorer, as illustrated in Figure 33, provides a comprehensive depiction of the neural network, encompassing all layers and information that can be visualized interactively, or in the produced PDF/JSON output (Appendix B Appendix C). On the other hand, the VisualKeras API, as shown in Figure 31a, presents certain limitations, such as its failure to represent the input layer and the absence of essential information 2The image was slightly edited to be able to fit in the page 52
for dense layers, like the number of units, leading to a default representation. Additionally, the inability to adjust the spacing between layers leads to a cluttered image representation. In comparison to NN Explorer, Keras Visualizer (Figure 32), provides a less detailed representation of the neural network architecture. With its layer information embedded within the layers, the resulting visualizations can quickly become cumbersome. Conversely, KerasPlot (Figure 31b), offers a uniform representation for all layers, which can make it challenging to interpret without delving into the specific layer information. Layer information exported In comparison to the NN Explorer, VisualKeras is found to be lacking in its ability to provide comprehensive information about the layers. NN Explorer offers users the unique capability to interact with the model, allowing them to select specific layers and access detailed information about each one. Furthermore, when exporting the model as an image, NN Explorer includes a JSON output file (Appendix B), or a PDF file (Appendix C), that contains extensive data about the layers, enhancing the depth of understanding and analysis of the network’s architecture. This provides users with valuable insights into the neural network’s inner workings, offering a level of detail that surpasses that of KerasPlot (Figure 31b) and represents an area where VisualKeras currently lacks. Keras Visualizer offers some information about the layers, yet it does not provide sufficient detail to fully comprehend the model. Moreover, it incorporates information directly into the visualization, resulting in small text and a quickly enlarging image, making it challenging to read without significant levels of zoom. API Result VisualKeras Does not represent the input layer, neither any information about the layers Keras Visualizer Does not represent all the needed information, it is too big to understand the information without significant zooming KerasPlot Shows every layer in the same way, and does not show all the relevant information about the layers Table 2: Results of tests of single branch model 53
5.1.2 Network with skip connections For the testing process, a network with skip connections was specifically utilized to ensure that each API can accurately handle and represent this architectural feature. This deliberate choice enables a comprehensive evaluation of how well each API can effectively interpret and visualize networks with skip connections, contributing to a more thorough assessment of their overall capabilities and performance. Figure 34: Model architecture with skip connections with KerasPlot Figure 35: Model architecture with skip connections with Neural Network Explorer The NN Explorer, as shown in Figure 35, provides a comprehensive representation of the neural network, encompassing all layers and connections correctly. In contrast, both VisualKeras and Keras 54
Visualizer, are unable to represent the skip connections, being impossible to understand the correct architecture of the model. Furthermore, KerasPlot (Figure 34), correctly displays the architecture, but its flat representation limits quick perception, necessitating a detailed examination to fully understand the model. API Result VisualKeras Does not support skip connections Keras Visualizer Does not support skip connections KerasPlot Represents the skip connection but needs a detail examination to understand the model Table 3: Results of tests of skip connections model 5.1.3 Multi-Branch network To facilitate the testing process, a specialized network architecture with two branches was employed, ensuring that each API can effectively manage and represent this intricate feature. This strategic approach facilitates a thorough evaluation of how adeptly each API can interpret and visualize networks characterized by multiple branches, thereby enriching the overall appraisal of their capabilities and performance. In this instance, it is evident that both VisualKeras and Keras Visualizer are unable to effectively manage and represent the multiple branches and skip connections within the model. This contrasts with the capabilities demonstrated by both KerasPlot (Figure 36), and NN Explorer (Figure 37). This emphasizes the significance of a robust visualization tool that can accurately capture and convey the intricate structure of complex neural network architectures, enabling users to grasp the model’s intricacies with ease and clarity. API Result VisualKeras Does not support multi-branches Keras Visualizer Does not support multi-branches KerasPlot Represents the multi branches but needs a detail examination to understand the model Table 4: Results of tests of multi branch model 55
Figure 36: Multi branch model architecture with KerasPlot Figure 37: Multi branch model architecture with Neural Network Explorer 56
5.1.4 Network with custom layers For this specific test, a network was employed featuring custom layers defined as extensions of Keras layers. This particular setup was chosen to assess the extensibility of the platform, given that these layers are not included in the standard Keras layers API. By testing the integration and performance of these custom layers within the network, the evaluation effectively gauges the platform’s capability to accommodate and effectively handle custom layers, thereby demonstrating its robust extensibility features. Figure 38: Model architecture with custom layers with KerasPlot 57
Chapter 6 Conclusions and future work This chapter provides a summary of the work carried out, presenting its main conclusions. In addition, it also presents possible future work avenues. 6.1 Conclusions The domains of Deep Learning and Machine Learning have witnessed remarkable progress, marked by the development of increasingly accurate and powerful models. However, the absence of a streamlined and intuitive method for visualizing these models without the need for manual design has presented a notable challenge. In response to this, this project was initiated to address the necessity for a platform capable of accepting various types of neural networks and presenting them in a simple and user-friendly manner. The platform, NN Explorer, was designed not only to facilitate an easy understanding of the diverse range of models but also to enable the export of representative images and detailed information about the network’s layers. To achieve this goal, a comprehensive analysis of the primary features and functionalities required was conducted, followed by a detailed examination of the platform’s architecture for effective implementation. This thorough analysis provided valuable insights into the suitable tools necessary to meet the project requirements. Furthermore, a critical review of the existing tools and APIs for visualizing neural networks was instrumental in identifying their limitations and guiding the development of our platform to address these issues effectively. Upon a comprehensive review of the implementation process and the obtained results, it is evident that our platform successfully fulfills the established requirements. It not only incorporates the positive aspects of existing tools and APIs but also rectifies their constraints and introduces novel functionalities such as an interactivity viewer, thereby positioning itself as the optimal choice for users seeking a comprehensive 64
and efficient neural network visualization solution. 6.2 Prospect for future work Moving forward, the next steps involve conducting comprehensive testing with a variety of new network types to ensure the robustness and reliability of the system, as well as to identify and rectify any potential bugs or issues. Additionally, efforts will be directed towards expanding platform capabilities by adding support for PyTorch, thereby enhancing its compatibility and usability across different frameworks. To further enhance the visualization aspect, there is a requirement to intensify the level of customization accessible to users, granting them the capability to personalize the visual representations in alignment with their unique needs. This could encompass the integration of supplementary layers of information to offer an all-encompassing comprehension of the model or the restructuring of the presentation of specific data. Furthermore, introducing the option to depict layers as 3D models could bolster user intuitiveness, simplifying the comprehension and interaction with the neural network architecture. Moreover, there is an opportunity to optimize the overall user experience by refining the platform’s interface, streamlining the navigation process, and introducing new features that facilitate smoother interaction and manipulation of the visualized models. These improvements will contribute to the platform’s continued evolution and ensure that it remains at the forefront of neural network visualization technology, catering to the diverse needs of researchers, developers, and machine learning enthusiasts. 65
Bibliography Arohan Ajit, Koustav Acharya, and Abhishek Samanta. A review of convolutional neural networks. In 2020 International Conference on Emerging Trends in Information Technology and Engineering (ic-ETITE) , pages 1–5, 2020. doi: 10.1109/ic-ETITE47903.2020.049. Atra Akandeh and Fathi M. Salem. Simplified long short-term memory recurrent neural networks: part ii. ArXiv , abs/1707.04626, 2017. Geoffrey E. Hinton Alex Krizhevsky, Ilya Sutskever. Imagenet classification with deep convolutional neural networks. In Proceedings of the 25th International Conference on Neural Information Processing Systems - Volume 1 , NIPS’12, page 1097–1105, Red Hook, NY, USA, 2012. Curran Associates Inc. Ulfi Andayani, E B Nababan, Baihaqi Siregar, Muhammad Anggia Muchtar, Tiger Hamonangan Nasution, and Ikhsan Siregar. Optimization backpropagation algorithm based on nguyen-widrom adaptive weight and adaptive learning rate. 2017 4th International Conference on Industrial Engineering and Applications (ICIEA) , pages 363–367, 2017. URL https://api.semanticscholar.org/CorpusID: 40527626. Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein gan. ArXiv , abs/1701.07875, 2017. Abdelhadi Azzouni and Guy Pujolle. A long short-term memory recurrent neural network framework for network traffic matrix prediction. ArXiv , abs/1705.05690, 2017. Dor Bank, Noam Koenigstein, and Raja Giryes. Autoencoders. ArXiv , abs/2003.05991, 2020. URL https://api.semanticscholar.org/CorpusID:212717965. G. Bebis and M. Georgiopoulos. Feed-forward neural networks. IEEE Potentials , 13(4):27–31, 1994. doi: 10.1109/45.329294. Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. CoRR , abs/1809.11096, 2018. URL http://arxiv.org/abs/1809.11096. 66
Jason Brownlee. A gentle introduction to pooling layers for convolutional neural networks, Jul 2019a. URL https://machinelearningmastery.com/ pooling-layers-for-convolutional-neural-networks/. Jason Brownlee. How to visualize a deep learning neural network model in keras, Sep 2019b. URL https://machinelearningmastery.com/ visualize-deep-learning-neural-network-model-keras/. Huiwen Chang, Jingwan Lu, Fisher Yu, and Adam Finkelstein. Pairedcyclegan: Asymmetric style transfer for applying and removing makeup. In 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition , pages 40–48, 2018. doi: 10.1109/CVPR.2018.00012. Haiyang Chen. Challenges and corresponding solutions of generative adversarial networks (gans): A survey study. Journal of Physics: Conference Series , 1827, 2021. doi: 10.1088/1742-6596/1827/ 1/012066. Pu-Chin Chen, Henry Tsai, Srinadh Bhojanapalli, Hyung Won Chung, Yin-Wen Chang, and Chun-Sung Ferng. A simple and effective positional encoding for transformers. In Conference on Empirical Methods in Natural Language Processing , 2021. URL https://api.semanticscholar.org/CorpusID: 243728757. François Chollet. Deep Learning with Python . Manning, November 2017. ISBN 9781617294433. Junyoung Chung, Çaglar Gülçehre, Kyunghyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. ArXiv , abs/1412.3555, 2014. Junyoung Chung, Çaglar Gülçehre, KyungHyun Cho, and Yoshua Bengio. Gated feedback recurrent neural networks. CoRR , abs/1502.02367, 2015. URL http://arxiv.org/abs/1502.02367. Dan Claudiu Ciresan, Ueli Meier, Luca Maria Gambardella, and Jürgen Schmidhuber. Deep big simple neural nets excel on handwritten digit recognition. CoRR , abs/1003.0358, 2010. URL http:// arxiv.org/abs/1003.0358. Antonia Creswell, Tom White, Vincent Dumoulin, Kai Arulkumaran, Biswa Sengupta, and Anil Anthony Bharath. Generative adversarial networks: An overview. IEEE Signal Processing Magazine , 35:53–65, 2017. 67
Eugenio Culurciello. The history of neural networks, Apr 2017. URL https://dataconomy.com/ 2017/04/history-neural-networks/. Maisa Daoud and Michael Mayo. Using swarm optimization to enhance autoencoders images. ArXiv , abs/1807.03346, 2018. URL https://api.semanticscholar.org/CorpusID:49671199. Pranav Dar. This python library visualizes artificial neural networks (anns) with just one line of code, Apr 2018. URL https://www.analyticsvidhya.com/blog/2018/04/ python-library-visualizes-artificial-neural-networks/. Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition , pages 248– 255, 2009. doi: 10.1109/CVPR.2009.5206848. Arden Dertat. Applied deep learning - part 3: Autoencoders, Oct 2017. URL https://towardsdatascience.com/ applied-deep-learning-part-3-autoencoders-1c083af4d798. Meghna Asthana PhD MSc DIC. Layers of a convolutional neural network, Mar 2020. URL https://medium.com/analytics-vidhya/ layers-of-a-convolutional-neural-network-168daddd2dd1. Educba. Keras plot model: How to plot model architecture in keras?, Oct 2022. URL https://www. educba.com/keras-plot-model/. Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. ArXiv , 1406.2661, 2014. Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C. Courville, and Yoshua Bengio. Generative adversarial networks. Communications of the ACM , 63:139 – 144, 2020. Alex Graves, Santiago Fernández, and Jürgen Schmidhuber. Multi-dimensional recurrent neural networks. ArXiv , abs/0705.2011, 2007. Anindya Gupta, Philip Harrison, Håkan Wieslander, Nicolas Pielawski, Kimmo Kartasalo, Gabriele Partel, Leslie Solorzano, A. Suveer, Anna Klemm, Ola Spjuth, Ida-Maria Sintorn, and Carolina Wählby. Deep learning in image cytometry: A review. Cytometry Part A , 95, 12 2018. doi: 10.1002/cyto.a.23701. 68
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR , abs/1512.03385, 2015. URL http://arxiv.org/abs/1512.03385. Sepp Hochreiter and Jürgen Schmidhuber. Long Short-Term Memory. Neural Computation , 9(8):1735– 1780, 11 1997. ISSN 0899-7667. doi: 10.1162/neco.1997.9.8.1735. URL https://doi.org/ 10.1162/neco.1997.9.8.1735. Changjie Hu, Xiaoli Hou, and Y. Lu. Improving the architecture of an autoencoder for dimension reduction. 2014 IEEE 11th Intl Conf on Ubiquitous Intelligence and Computing and 2014 IEEE 11th Intl Conf on Autonomic and Trusted Computing and 2014 IEEE 14th Intl Conf on Scalable Computing and Communications and Its Associated Workshops , pages 855–858, 2014. URL https: //api.semanticscholar.org/CorpusID:18800477. Gao Huang, Zhuang Liu, and Kilian Q. Weinberger. Densely connected convolutional networks. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR) , pages 2261–2269, 2016. URL https://api.semanticscholar.org/CorpusID:9433631. Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. CoRR , abs/1502.03167, 2015. URL http://arxiv.org/abs/1502.03167. Yacine Jernite, Edouard Grave, Armand Joulin, and Tomas Mikolov. Variable computation in recurrent neural networks. ArXiv , abs/1611.06188, 2016. Teng Jiang, Chengjun Zhan, and Yupu Yang. Long short-term memory network with external memories for image caption generation. Journal of Electronic Imaging , 28:023022 – 023022, 2019. Uday Kamath, John Liu, and James Whitaker. Convolutional Neural Networks , page 263–314. Springer International Publishing, 2019. doi: 10.1007/978-3-030-14596-5_6. Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. ArXiv , abs/1710.10196, 2017. Salman Hameed Khan, Muzammal Naseer, Munawar Hayat, Syed Waqas Zamir, Fahad Shahbaz Khan, and Mubarak Shah. Transformers in vision: A survey. ACM Computing Surveys (CSUR) , 54:1 – 41, 2021. URL https://api.semanticscholar.org/CorpusID:230435805. Diederik P. Kingma and Max Welling. An introduction to variational autoencoders. ArXiv , abs/1906.02691, 2019. URL https://api.semanticscholar.org/CorpusID:174802445. 69
Alex Labach, Hojjat Salehinejad, and Shahrokh Valaee. Survey of dropout methods for deep neural networks. ArXiv , abs/1904.13310, 2019. URL https://api.semanticscholar.org/CorpusID: 140439701. Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE , 86(11):2278–2324, 1998. doi: 10.1109/5.726791. Jiwei Li, Will Monroe, Tianlin Shi, Sébastien Jean, Alan Ritter, and Dan Jurafsky. Adversarial learning for neural dialogue generation. ArXiv , abs/1701.06547, 2017. Rundong Li, Jianhao Hu, and Shuyuan Yang. Deep gated recurrent unit convolution network for radio signal recognition. In 2019 IEEE 19th International Conference on Communication Technology (ICCT) , pages 159–163, 2019. doi: 10.1109/ICCT46805.2019.8947225. Yanjun Li and Yongquan Yan. Training autoencoders using relative entropy constraints. Applied Sciences , 2022. URL https://api.semanticscholar.org/CorpusID:255207827. Kevin J Liang, Chunyuan Li, Guoyin Wang, and Lawrence Carin. Generative adversarial network training is a continual learning problem. ArXiv , abs/1811.11083, 2018. Juntao Liu, Caihua Wu, and Junwei Wang. Gated recurrent units based neural network for time heterogeneous feedback recommendation. Inf. Sci. , 423:50–65, 2018. Yi Luo, Zhuo Chen, and Takuya Yoshioka. Dual-path rnn: efficient long sequence modeling for time-domain single-channel speech separation. ArXiv , abs/1910.06379, 2020. Devashree Madhugiri. Visualize deep learning models using visualkeras, Apr 2023. URL https://www.analyticsvidhya.com/blog/2022/03/ visualize-deep-learning-models-using-visualkeras/. Ali Masri. An intuitive explanation to dropout, Jul 2019. URL https://towardsdatascience.com/ an-intuitive-explanation-to-dropout-749c7fb5395c. Yuki Nakahira and Kazuhiko Kawamoto. Generative adversarial networks for generating rgb-d videos. In 2018 Asia-Pacific Signal and Information Processing Association Annual Summit and Conference (APSIPA ASC) , pages 1276–1281, 2018. doi: 10.23919/APSIPA.2018.8659648. 70
Christopher Nixon, Mohamed H. Sedky, and Mohamed Hassan. Autoencoders: A low cost anomaly detection method for computer network data streams. Proceedings of the 2020 4th International Conference on Cloud and Big Data Computing , 2020. URL https://api.semanticscholar.org/ CorpusID:221882281. Atilla Özgür and Fatih Nar. Effect of dropout layer on classical regression problems. 2020 28th Signal Processing and Communications Applications Conference (SIU) , pages 1–4, 2020. URL https:// api.semanticscholar.org/CorpusID:231600966. Ilya A. Pyatnisky and Alexander N. Sokolov. Assessment of the applicability of autoencoders in the problem of detecting anomalies in the work of industrial control systems. 2020 Global Smart Industry Conference (GloSIC) , pages 234–239, 2020. URL https://api.semanticscholar.org/CorpusID: 227277557. Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. CoRR , abs/1511.06434, 2015. RedaOps. Redaops/ann-visualizer: A python library for visualizing artificial neural networks (ann), 2018. URL https://github.com/RedaOps/ann-visualizer/tree/master. Alexander Rehmer and Andreas Kroll. On the vanishing and exploding gradient problem in gated recurrent units. IFAC-PapersOnLine , 53:1243–1248, 01 2020. doi: 10.1016/j.ifacol.2020.12.1342. Mayu Sakurada and Takehisa Yairi. Anomaly detection using autoencoders with nonlinear dimensionality reduction. In MLSDA’14 , 2014. URL https://api.semanticscholar.org/CorpusID: 14613395. Terence Sanger and Pallavi N. Baljekar. The perceptron: a probabilistic model for information storage and organization in the brain. Psychological review , 65 6:386–408, 1958. URL https://api. semanticscholar.org/CorpusID:12781225. M. Schuster and K.K. Paliwal. Bidirectional recurrent neural networks. IEEE Transactions on Signal Processing , 45(11):2673–2681, 1997. doi: 10.1109/78.650093. Adesh Shah. Visualizing artificial neural networks (anns) with just one line of code, Apr 2018. URL https://towardsdatascience.com/ visualizing-artificial-neural-networks-anns-with-just-one-line-of-code-b4233607209e. 71
Hava T. Siegelmann. Recurrent neural networks , pages 29–45. Springer Berlin Heidelberg, Berlin, Heidelberg, 1995. ISBN 978-3-540-49435-5. doi: 10.1007/BFb0015235. URL https://doi.org/ 10.1007/BFb0015235. Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556 , 2015. URL https://arxiv.org/abs/1409.1556. Hendrik Strobelt, Sebastian Gehrmann, Bernd Huber, Hanspeter Pfister, and Alexander M. Rush. Visual analysis of hidden state dynamics in recurrent neural networks. ArXiv , abs/1606.07461, 2016. Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott E. Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. CoRR , abs/1409.4842, 2014. URL http://arxiv.org/abs/1409.4842. Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. CoRR , abs/1512.00567, 2015. URL http://arxiv. org/abs/1512.00567. Yi Tay, Dara Bahri, Donald Metzler, Da-Cheng Juan, Zhe Zhao, and Che Zheng. Synthesizer: Rethinking self-attention in transformer models. In International Conference on Machine Learning , 2020. URL https://api.semanticscholar.org/CorpusID:218487423. Towards AI Team. Introduction to pooling layers in cnn, Aug 2022. URL https://towardsai.net/ p/l/introduction-to-pooling-layers-in-cnn. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. CoRR , abs/1706.03762, 2017. URL http: //arxiv.org/abs/1706.03762. Mario Ventresca and Hamid R. Tizhoosh. Opposite transfer functions and backpropagation through time. In 2007 IEEE Symposium on Foundations of Computational Intelligence , pages 570–577, 2007. doi: 10.1109/FOCI.2007.371529. Yugesh Verma. A complete understanding of dense layers in neural networks, Jan 2023. URL https://analyticsindiamag.com/ a-complete-understanding-of-dense-layers-in-neural-networks/. 72
Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. CoRR , abs/1609.02612, 2016. URL http://arxiv.org/abs/1609.02612. J. Wang, Haibo He, and Danil V. Prokhorov. A folded neural network autoencoder for dimensionality reduction. In International Neural Network Society Winter Conference , 2012. URL https://api. semanticscholar.org/CorpusID:33723086. Tianqi Wang, Chao-Kai Wen, Hanqing Wang, Feifei Gao, Tao Jiang, and Shi Jin. Deep learning for wireless physical layer: Opportunities and challenges. China Communications , 14:92–111, 10 2017. doi: 10. 1109/CC.2017.8233654. Ze Wang, Xiuyuan Cheng, Guillermo Sapiro, and Qiang Qiu. Acdc: Weight sharing in atom-coefficient decomposed convolution. ArXiv , abs/2009.02386, 2020. URL https://api.semanticscholar. org/CorpusID:221516738. Ruoqi Wei, Cesar Garcia, Ahmed El-Sayed, Viyaleta Peterson, and Ausif Mahmood. Variations in variational autoencoders - a comparative evaluation. IEEE Access , 8:153651–153670, 2020. URL https: //api.semanticscholar.org/CorpusID:221386403. Ronald J. Williams and Jing Peng. An Efficient Gradient-Based Algorithm for On-Line Training of Recurrent Network Trajectories. Neural Computation , 2(4):490–501, 12 1990. ISSN 0899-7667. doi: 10.1162/ neco.1990.2.4.490. URL https://doi.org/10.1162/neco.1990.2.4.490. Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, and Jamie Brew. Transformers: State-of-the-art natural language processing. In Conference on Empirical Methods in Natural Language Processing , 2019. URL https://api.semanticscholar.org/CorpusID:208117506. Kamanda Wycliffe. Tensorboard tutorial (deep dive with examples and notebook), Apr 2023. URL https: //www.machinelearningnuggets.com/tensorboard-tutorial/. Aston Zhang, Zachary C. Lipton, Mu Li, and Alexander J. Smola. Dive into deep learning. CoRR , abs/2106.11342, 2021. URL https://arxiv.org/abs/2106.11342. Changqing Zhang, Yu Geng, Zongbo Han, Yeqing Liu, H. Fu, and Qinghua Hu. Autoencoder in autoencoder networks. IEEE transactions on neural networks and learning systems , PP, 2022. URL https://api. semanticscholar.org/CorpusID:250559688. 73
Appendix C Result PDF of NN Explorer Figure 49: PDF output 80
Figure 50: PDF output 81
Figure 51: PDF output 82
83
Appendix D VGG 16 architecture with Keras Plot Figure 52: VGG 16 architecture with KerasPlot 84
Figure 53: VGG 16 architecture with KerasPlot 85
86
Appendix E VGG 16 architecture with Keras Visualizer Figure 54: VGG 16 architecture with KerasVisualizer 87
Figure 55: VGG 16 architecture with KerasVisualizer 88
Figure 56: VGG 16 architecture with KerasVisualizer 89
Figure 62: Inception V3 architecture with KerasPlot 96
Figure 63: Inception V3 architecture with KerasPlot 97
Figure 64: Inception V3 architecture with KerasPlot 98
Figure 65: Inception V3 architecture with KerasPlot 99
Figure 66: Inception V3 architecture with KerasPlot 100
Figure 67: Inception V3 architecture with KerasPlot 101
Appendix G Transformer architecture with Keras Plot Figure 68: Transformer architecture with KerasPlot 102
Figure 69: Transformer architecture with KerasPlot Figure 70: Transformer architecture with KerasPlot 103
Figure 71: Transformer architecture with KerasPlot 104
Figure 72: Transformer architecture with KerasPlot 105