CNN Visualizer
CNN Visualizer
JEGAN PRABHU M
19MSS019
APRIL 2024
Sri Krishna Arts and Science College
DECLARATION
I hereby declare that the Project report entitled “Convolutional Neural Network
Visualizer” submitted in partial fulfillment of the requirements for the award of
degree of Master of Science in Software Systems is an original work and it has not
previously formed the basis for the award of any Degree, Diploma, Associateship,
Fellowship or similar titles to any other university or body during the period of my
study.
Place: Coimbatore
Date:
CERTIFICATE
This is to certify that the project report
entitled "Convolutional Neural Network
Visualizer" submitted in partial fulfillment of
of Science in Software Systems is a
requirements for the degree of Master
record of bonafide work carried out by Jegan
Prabhu M, 19MSSO19 and that no part of this has
been submitted for the award of
any other degree or diploma and the
work has not been published in popular journal
or magazine.
Dr.ITHA
Associate Professor and Head
Depattment of Software Systems
Stri Erishna Arts and Scie nce College
Euniyamuthur, Coimbatore -641 0D8
This Project Report is submitted for the Viva Voce
examination conducted on
13.4 24, at Sri Krishna Arts and Science College.
The satisfaction and euphoria of the successful completion of any task would be
incomplete without the mention of the people who made it possible, whose constant
guidance, encouragement, crowned my effort with success.
M.Phil., Ph.D., and Head of the Department Dr. C. SUNITHA, MCA, M.Phil.,
Ph.D., who has given permission for the fulfilment of the venture.
Finally, I thank my parents, family members, and my beloved friends for their
moral support and encouragement without which I would not have been able to follow
my dreams.
Jegan Prabhu
19MSS019
TABLE OF CONTENTS
PAGE
S. NO. CONTENTS
NO
1 Introduction
1.1 Project Overview 2
1.2 Project Objective 2
1.3 Organization Profile 3
1.4 Module Description 3
2 Literature Study 5
3 System Specification
3.1 Hardware Specification 9
3.2 Software Specification 9
4 System Study
4.1 Existing System with limitations 12
4.2 Proposed System with advantages 13
5 Dataset
5.1 Dataset Description 14
6 System Design
6.1 Use case Diagram 15
6.2 Data Flow Diagram 16
7 System Testing
7.1 Unit Testing 18
7.2 Verification Testing 20
7.3 Performance Testing 21
7.4 Acceptance Testing 22
8 System Implementation and Maintenance
8.1 Implementation Procedures 23
8.2 Maintenance Procedures 24
9 Conclusion 25
10 Scope for Future Enhancements 26
Bibliography 27
Appendix
A Use Case Diagram 28
B Data Flow Diagram 29
C Dataset Images 30
D Sample Screenshots 32
E Sample Code 36
CONVOLUTIONAL NEURAL NETWORK VISUALIZER SKASC-2024
CHAPTER 1
INTRODUCTION
The user-centric design of the platform allows individuals to effortlessly upload images,
with the ultimate aim of the model classifying them within the pre-trained 10 categories.
Beyond mere classification, the project focusses the significance of visualization to provide
users with insights into the decision-making process of the Convolutional Neural Network
(CNN). Developed entirely in JavaScript, the project provides a user-friendly interface,
complete with detailed network exploration.
The Convolutional Neural Network Visualizer project distinguishes itself by not merely
delivering classification results but by demystifying the intricacies of CNNs. The commitment
to transparency and user engagement is evident in features that allow users to interact with the
classification process actively. The project is a testament to the evolving landscape of artificial
intelligence and image processing, offering a valuable resource for researchers, developers, and
enthusiasts seeking to enhance their understanding of Convolutional Neural Networks.
and SoftMax layers is conducted, with a particular emphasis on identifying their combined
contributions to the neural network's built-in decision-making processes. The subsequent
scientific analyses include model correctness, performance measures, and the subtle impact of
hyperparameters on convergence.
Concurrently, the project aims to translate its scientific discoveries into concrete
applications in the real world. The project serves as an approachable instrument for smooth
picture categorization, meeting the real-world requirements of people looking for a simple fix
for image recognition problems. The user interface makes it simple to upload images and
receive precise categorizations within previously learned categories. Designed to be an
instructional tool, especially for non-technical users, the project's intuitive interface helps to
deconstruct the complexity of CNNs and foster a deep understanding of picture categorization
procedures. The project provides researchers and image analysis specialists with a wide range
of insights and visualizations that enhance their ability to understand CNN decision-making
dynamics and make well-informed decisions in their respective fields.
Enables uniform data transfer and, crucial for starting the classification pipeline through input
image acquisition, and facilitates user interaction by implementing a secure image upload
mechanism.
Introduces non-linearity to the model's decision boundaries and optimizes convergence during
the training phase by implementing the Rectified Linear Unit (ReLU) activation function
within the CNN architecture.
Optimizes the effectiveness of the image classification process by integrating pooling layers
for spatial subsampling and carefully down sampling feature maps to preserve important
information while lowering computational complexity.
Utilizes SoftMax layers as the last activation function to convert raw scores into probability
distributions among categories, which makes it easier to make a final classification decision
and confirms that the model's output implies a probabilistic framework.
Visualization Module:
Develops complex visualizations with the D3.js framework to clarify the multi-dimensional
feature maps and activation patterns in the CNN. It improves interpretability and helps identify
features in the image.
Builds an interactive and responsive user interface by integrating JavaScript frameworks such
as React.js to allow for the exploration of the architecture, weights, and activations of the neural
network.
Using deep learning frameworks like TensorFlow, the integration of the Tiny VGG model
architecture captures convolutional and fully connected layers to achieve a balance between
computational efficiency and model expressiveness for image classification tasks.
CHAPTER 2
LITERATURE SURVEY
Deep learning is an aspect of artificial intelligence (AI) that is concerned with emulating the
learning approach that human beings use to gain certain types of knowledge. It is inspired by
the functionality of our brain cells called neurons. At its simplest, deep learning can be thought
of as a way to automate predictive analysis with the collection of algorithms used in machine
learning used to model high-level abstractions in data through the use of model architectures,
which are composed of multiple nonlinear transformations. It is a part of a broad family of
methods used for machine learning that are based on learning representations of data. Deep
learning removes the manual identification of features in data and instead relies on whatever
training process it has in order to discover the useful patterns in the input examples. This makes
training the neural network easier and faster and it can yield a better result that advances the
field of artificial intelligence.
Various deep learning techniques are employed to solve various problems. Some of them are:
❖ Fully Connected Neural networks
A neural network contains layers of interconnected nodes. Each node is a perceptron and is
similar to a multiple line regression. The perceptron feeds signal produced by a multiple linear
regression into an activation function that may be non-linear. In a multi-layered perceptron
(MLP), Perceptron’s are arranged in interconnected layers. The input layer collects input
patterns. The output layer has classifications or output signals to which input signals may map.
The hidden layers extrapolate salient features in the input data that have predictive power
regarding the outputs. This describes feature extraction, which accomplishes a utility similar to
statistical techniques such as principal component analysis.
A Convolutional Neural Network (CNN) is a type of artificial neural network used in image
recognition and processing that is specifically designed to process pixel data. CNNs are
powerful image processing, artificial intelligence (AI) that use deep learning to perform both
generative and descriptive tasks, often using machine vision that includes image and video
recognition, along with recommender systems and natural language processing (NLP). A neural
network is a system of hardware or software patterned after the operation of neurons in the
human brain.
Traditional neural networks are not ideal for image processing and must be fed images, in
reduced-resolution pieces. CNN have their neurons arranged more like those of the frontal lobe,
the area responsible for processing visual stimuli in humans and other animals. The layer of
neurons is arranged in such a way as to cover the entire visual field avoiding the piece meal
image processing problem of traditional neural networks.
The layers of a CNN consist of an input layer, an output layer and a hidden layer that includes
multiple convolutional layers, pooling layers, fully connected layers and normalization layers.
The removal of limitations and increase in efficiency for image processing results in a system
that is far more effective, simpler to trans limited for image processing and natural language
processing.
Convolutional neural networks are a category of Neural networks that have proven very
effective in areas such as image recognition and classification. ConvNets have been successful
in identifying faces, objects, and traffic signs apart from powering vision in robots and self-
driving cars. In this project, CNN needs to construct three conventional layers and three max-
pooling layers, and a fully connected layer in the convolutional network. Finally, a soft-max
layer is used to aggregate and get the results.
❖ Convolutional layer
The convolutional layer is the core building block of a CNN. The layer’s parameters consist of
a set of learnable filters, which have a small receptive field but extend through the full depth
of the input volume. During the forward pass, each filter is convolved across the width and
input volume., computing the dot product between the entries of the filter and the input and
producing a 2-dimensional activation map of that filter. As a result, the network learns filters
that activate when some specific type of feature at some spatial position in the input.
❖ Pooling Layer
Another important concept of CNN is pooling, which is a form of nonlinear down sampling.
There are several non-linear functions to implement pooling among which max pooling is the
most common. It partitions the input image into a set of non-overlapping rectangles and for
each such subregion, outputs the maximum. The intuition is that the exact location of a feature
is less important than the rough location relative to other features. The pooling layer serves to
progressively reduce the spatial size of the representation, to reduce the number of parameters
and amount of computation in the network and hence to control overfitting. It is common to
periodically insert a pooling layer between successive convolutional layers in CNN.
ReLU layer applies the non-saturating activation function f(x) = max (0, x). It increases the
nonlinear properties of the decision function and of the overall network without affecting the
receptive fields of the convolutional layer. ReLU refers to Rectifier Unit, the most commonly
deployed activation function for the outputs of the CNN neurons. This activation function was
first introduced to a dynamic network by Hahn loser. It has been demonstrated for the first time
in 2011 to enable better training of deeper networks.
Finally, after several convolutional and max pooling layers, the high-level reasoning in the
neural network is done via fully connected layers. Neurons in a fully connected layer have
connections to all activations in the previous layer, as seen in regular neural networks.
❖ Image Recognition
CNN are often used in image recognition system. The ImageNet Large Scale Visual
Recognition Challenge is a benchmark in object classification and detection, with millions of
images and hundreds of object classes. In 2015 as many layered CNN demonstrated the ability
to spot faces from a wide range of angles, including upside down, even when partially occluded,
with competitive performance. The network was trained on a database of 200000 images that
included faces at various angles and orientations and a further 20 million images without faces.
They used batches of 128 images over 50,000 iterations.
CHAPTER 3
SYSTEM SPECIFICATION
Python
Python is open-source and free software that is easy to learn. Python supports Object oriented
language. GUI can be created using TK in python. Python is a high-level language that can be
integrated with other programming languages like C/C++. Python has a rich set of libraries so
the user does not have to write code for every single thing. Python is a computer language that
supports multiple paradigms. In addition to object-oriented programming and structured
programming, many of its features support functional programming and aspect-oriented
programming. Extensions support a number of paradigms, including design by contract and
logic programming. Python manages memory with dynamic typing, reference counting, and a
cycle detecting garbage collector. It employs late binding (dynamic name resolution) to bind
method and variable names during programme execution.
TensorFlow
JavaScript
JavaScript is an open-source and widely-used programming language that is renowned for its
versatility and ease of learning. As a client-side scripting language, JavaScript is primarily used
for creating dynamic and interactive web pages. It supports object-oriented, imperative, and
functional programming paradigms, offering developers the flexibility to choose the approach
that best suits their needs. JavaScript seamlessly integrates with HTML and CSS, making it an
integral part of front-end web development.
In addition to its role in web development, JavaScript is also employed on the server side
(Node.js) for building scalable and efficient server applications. It has a rich ecosystem of
libraries and frameworks, such as React, Angular, and Vue.js, that facilitate the development
of robust and feature-rich web applications. JavaScript's support for asynchronous
programming, through features like Promises and async/await, enhances the efficiency of
handling concurrent operations.
Svelte
Svelte, on the other hand, is a modern and innovative front-end framework designed to
streamline the development of web applications. It shifts the burden of heavy lifting from the
client-side to the build process, resulting in smaller and faster applications. Svelte embraces a
component-based architecture, enabling developers to create reusable and modular UI
components effortlessly. It offers a refreshing approach by compiling components into highly
optimized JavaScript at build time, resulting in a more efficient runtime performance.
Svelte's declarative syntax and reactive programming model make it easy for developers to
express complex UI behaviours with minimal code. It eliminates the need for a runtime
framework in the final application, reducing the overall bundle size and enhancing the user
experience. With its focus on simplicity and performance, Svelte has gained popularity among
developers seeking a modern and efficient alternative for building web applications.
CHAPTER – 4
SYSTEM STUDY
❖ Framework-agnostic versatility
CHAPTER 5
DATASET
CHAPTER 6
SYSTEM DESIGN
The process of researching a procedure or business in order to establish its goals, purposes, and
construct systems and procedures that will achieve them in an effective manner, according to
the definition of system design. Another perspective sees system analysis as a problem-solving
technique that disassembles a system into its component elements in order to examine how
well those parts operate together to achieve their goals.
Notations
Actor:
Actors are the people or things who interact with a computer system. Although actors are most
often employed to represent system users, they can also represent anything that needs to
communicate information with the system.
Association:
An actor and a use case can be linked to show that the actor is involved in that use case. As a
result, an association denotes a series of actions taken by the actor and the use case to
accomplish the use case.
Use Case:
High-level functionalities and how the user will interact with the system are represented by use
cases. A use case describes a specific feature of a system, component, package, or class. It's
represented by an oval shape with the name of a use case written inside.
System flow diagrams represent the flow of data within a system graphically. It shows several
steps that identify where input is coming from and where output is going. By using the diagram,
we can determine the event decisions of the system and how data flows into the system.
Therefore, the system flow diagram is essentially a visual representation of data flow that
excludes minor parts and highlights the significant parts of the system in a sequential manner.
The System Flow diagram of CNN Visualizer is given in appendix B.
Rectangle:
It is the workhorse of the flowchart diagram, representing any step in the process you're
describing. Rectangles can be used to capture process phases such as fundamental chores or
actions.
Diamond:
The diamond represents the need to make a decision in order to go forward. This could be a
simple yes-or-no decision or a more involved decision with several options.
Arrows:
The viewer is guided along their flowcharting journey by the arrow. While there are numerous
sorts of arrow tips to select from. This not only keeps your diagram tidy, but it also helps you
to highlight specific steps in your process.
CHAPTER 7
SYSTEM TESTING
Errors can be introduced into a software development project at any point during the process.
Testing is extremely important for software quality and reliability. During testing, the
programme under test is run with a set of test cases, and the program's output for the test cases
is analysed to see if the programme is working as expected. The primary goal of testing is to
find errors in the system. The user must provide accurate data to the system during the
uncovering process. As a result, the user should be more cautious when entering data. It is
critical to provide accurate inputs for effective testing. Testing is the process of running a
software in order to identify a mistake. Testing is an important part of software quality
assurance since it provides the final assessment of the specification, design, and coding. The
phase of system testing is crucial. Testing is an unusual feature of software. Thus, before the
proposed system is ready for user acceptance testing, it must undergo a number of tests. A
excellent test case is one that has a high chance of being identified as an error. A successful test
is one that uncovers a previously unknown flaw.
In Unit Testing, we have to test the programs making up the system. For this reason, Unit
Testing is sometimes called program testing. The software units in a system are the modules
and routines that are assembled and integrated to perform a specific function. Unit Testing
focuses first on modules, independently of one another, to locate errors. This enables to
detection of errors in coding and logic that are contained within the module alone.
The testing was carried out during the programming stage itself. In the testing step, each
module is found to be working satisfactorily as regards to being expected output from the
module.
The number of input/output operations, global and local variables, scope and validity, call to
other modules, file attributes and database exceptions and expressions are also tested in each
and every module.
split_val_data(): This function involves copying validation images to different directories. Unit
tests is written to ensure that the splitting logic works as expected.
The TinyVGG class: Unit tests is be written to ensure that the model is constructed correctly
with the expected layers and configurations.
train_step(), vali_step(), and test_step(): These functions involve training and evaluating the
model. Unit tests is written to check if these functions perform the expected operations and
update metrics correctly.
The training loop and associated functions (train_step(), vali_step(), and test_step()):
The training and evaluation process is fundamental to verification testing. It ensures that the
model is being trained according to the specified requirements. Verification would involve
checking if the loss, accuracy, and early stopping mechanisms align with the expected
behaviour.
Model saving and loading are important aspects of verification testing. It ensures that the
trained model can be saved and loaded correctly, demonstrating that the model's state is
preserved and can be reused as specified in the requirements.
The amount of executing time spent in various paths of the programme unit, programme
throughput, reaction time, and utilisation by the programme unit are all determined through
performance Testing. The greatest volume of existing data that the system can process with
an effective throughput and efficient use of system resources is the basis for Performance
Testing. This type of software system meets the needs of the users, adheres to the
requirements and design specifications, and is error-free. The final step should be a software
audit, which verifies that the entire software project complies with production management
requirements. This ensures that all requirement documentation is complete, in the correct
format, and of acceptable quality.
Acceptance testing involves planning and executing functional tests, performance tests, and
stress tests in order to demonstrate that the implemented system satisfies its requirements.
Functional test cases involve excising the code with normal input values for which expected
results are known. The final process should be a software audit where the complete software is
checked to ensure that it meets production management requirements. This ensures that all
required documentation have been produced, is in correct format and is of acceptable quality.
CHAPTER 8
SYSTEM IMPLEMENTATION AND MAINTENANCE
Implementation is the stage of the project where the theoretical design is turned into a working
system. At this stage, the main workload, the greatest upheaval, and the major impact on the
existing system shift to the user department. If the implementation is not carefully planned a
controlled it can cause chaos and confusion.
Performance Optimization:
Implement performance optimizations, such as caching and prefetching, to enhance the
efficiency of data processing during training.
● Careful planning
● Investigating of system and constraints
● Design of methods to achieve changeover
● Training of the staff in the changeover phase
● Evaluation of the changeover method
The maintenance phase of the software cycle is the time in which a Software product performs
useful work. After a system is successfully implemented, it should be maintained in a proper
manner. System maintenance is an important aspect is aspect in the software development life
cycle.
Performance Monitoring:
Continuously monitor the performance of the trained model, identifying potential areas for
improvement.
Implement optimizations based on the monitoring results.
Data Updates:
If the Tiny ImageNet dataset is periodically updated, implement procedures to integrate new
data into the system.
Documentation Updates:
Keep documentation, including code comments and user guides, up-to-date with any changes
in the system.
The fourth maintenance activity occurs when software is changed to improve future
maintainability or reliability or to provide a better basis for future enhancements. Often called
preventive maintenance, this activity is characterized by reverse engineering.
CHAPTER 9
CONCLUSION
In conclusion, the CNN Explainer project has been a journey of exploration and
discovery into the fascinating world of Convolutional Neural Networks. Through this project,
we aimed to create an accessible and informative platform that demystifies the workings of
CNNs and provides users with a deeper understanding of this powerful machine learning
technique.
Throughout the development process, I have delved into the underlying principles of
CNNs, from convolutional layers and pooling operations to activation functions and fully
connected layers. I have broken down complex concepts into digestible explanations,
supplemented with visual aids, interactive examples, and real-world applications to enhance
comprehension.
The CNN Explainer project serves as a valuable resource for students, researchers, and
enthusiasts alike, offering a comprehensive overview of CNNs and their applications across
various domains, including computer vision, natural language processing, and healthcare.
Looking ahead, there are several avenues for future enhancement and expansion of the
CNN Explainer project. I’ve envision incorporating additional features, such as advanced
visualization tools, and case studies, to further enrich the learning experience. Furthermore,
ongoing updates and improvements will be made to keep pace with advancements in CNN
research and technology.
CHAPTER 10
SCOPE FOR FUTURE ENHANCEMENT
Multi-Modal Learning
Instead of just using pictures, we can also include other types of information, like text
or sound. This can help the model understand the images better by giving it more context.
Explore multi-modal learning approaches that incorporate additional modalities such as text or
audio data to enhance the model's understanding and performance in multi-modal applications.
Bibliography
[1] Tiny ImageNet Visual Recognition Challenge. https: //tiny-imagenet.herokuapp.com,
2015.
[5] A. Bilal, A. Jourabloo, M. Ye, X. Liu, and L. Ren. Do Convolutional Neural Networks
Learn Class Hierarchy? IEEE Transactions on Visualization and Computer Graphics,
24(1):152–162, Jan. 2018.
[7] M. H. Brown. Algorithm Animation. MIT Press, Cambridge, MA, USA, 1988.
Appendix
C. Dataset Images
D. Sample Screenshots
E. Sample Code
Draw-utl.js
// Configs
/**
*/
// Scalar
// 1D array
min = array[i];
max = array[i];
// 2D array
min = array[i][j];
max = array[i][j];
/**
* // Inspired by https://github.com/caged/d3-tip/blob/master/index.js#L286
*/
targetel = targetel.parentNode;
point.x += 0;
point.y -= height / 2;
return {
top: bbox.y,
left: bbox.x
};
/**
*/
return {
x: point.x + nodeLength,
y: point.y + nodeLength / 2
};
/**
*/
return {
x: point.x,
y: point.y + nodeLength / 2
/**
*/
if (isOutput) {
cnn[l-1][0].output.length;
continue;
linkData.push({
source: curSource,
target: curTarget,
weight: curWeight,
targetLayerIndex: l,
targetNodeIndex: n,
sourceNodeIndex: inputNodeIndex
});
return linkData;
/**
*/