Professional Documents
Culture Documents
BELAGAVI, KARNATAKA.
AN INTERNSHIP REPORT
ON
Submitted by
ARJUN C M 4JN20CS013
CERTIFICATE
This is to certify that the internship entitled
Submitted by
ARJUN C M 4JN20CS013
Signature of HOD
Examiners: 1. 2.
ABSTRACT
Fall detection is a critical aspect of ensuring the safety and well-being of individuals, particularly
in contexts such as eldercare and healthcare facilities. Leveraging the advancements in artificial
intelligence and machine learning (AIML), this internship project aims to develop an efficient
human fall detection system using the PyTorch framework. The project begins with a
comprehensive exploration of existing fall detection methods and the challenges they pose.
Traditional methods often suffer from limitations in accuracy and scalability, motivating the
adoption of deep learning techniques facilitated by frameworks like PyTorch. Through this
internship project, participants will delve into PyTorch's capabilities, including its dynamic
computation graph and ease of model development. They will gain hands-on experience in dataset
preparation, model architecture design, and the training process using PyTorch.
i
ACKNOWLEDGEMENT
On presenting the internship seminar on “Deep Learning using PyTorch for Fall
Detection” I feel great to express my humble feelings of thanks to all those who have
helped me directly or indirectly in the successful completion of the internship seminar.
I would like to thank my respected guide Mrs. Thaseen Bhashith, Assistant
Professor, Dept. of CS&E, for her valuable suggestions and treasured assistance
throughout the internship and seminar.
I would like to thank my respected internship Seminar coordinator Mrs. SreedeviS
, Assistant Professor, Dept. of CS&E who have helped me a lot in completing this task,
for their continuous encouragement and guidance throughout the internship seminar.
I would like to thank Dr. Jalesh Kumar, Professor & Head, Dept. of CS&E, and
Dr. Y Vijaya Kumar, Principal, JNNCE, Shimoga for all their support and
encouragement.
I express my profound thanks to Ekathva Innovations Pvt. Ltd., Shimoga, and the
resource person Dr. Chetan K R, Professor & Head, Dept. of AI&ML for providingan
opportunity to carry out internship in their organization.
I am grateful to our institution Jawaharlal Nehru New College of Engineering and
Department of Computer Science and Engineering for imparting to me the knowledge
with which I can do my best.
Finally, I would also like to thank the whole teaching and non-teaching staff of
Computer Science and Engineering.
ARJUN C M
4JN20CS013
ii
TABLE OF CONTENT
ABSTRACT i
ACKNOWLEDGEMENT ii
TABLE OF CONTENT iii
Chapter 1 Company Profile 1-2
1.1 JNNCE EI 1-2
1.2 Ekathva Innovations Pvt.Ltd. 2
Chapter 2 About the Company 3-7
2.1 Initiatives of CIE 3-4
3.1.4 CNN 11
3.2 Soft Skills 11-12
3.3 Experiences 12
Chapter 4 Reflection Notes 13-22
4.1 Assignments 13-18
4.2 Project Overview 19
4.3 Implementation 20-24
Chapter 5 Conclusion 26
Bibliography 27
iii
Deep Learning using PyTorch for Fall Detection
Chapter 1
COMPANY PROFILE
The internship was carried out at Jawaharlal Nehru New College of Engineering,
Shivamogga. It was carried out under JNNCE EI LEARN Platform – a collaboration
between JNN College of Engineering with Ekathva Innovations Pvt. Ltd. The profile of
JNNCE EI and Ekathva Innovations Pvt. Ltd. are discussed in the following sections.
JNNCE EI
JNNCE - EI LEARN platform builds an online learning platform to engage the student
community with courses offered in the latest, trending technologies to make them job ready
by task-based, project-based courses by industry and academic trainers.
These Certification Courses are required for various reasons as mentioned below:
These courses provide in-depth knowledge of the underlying technology needed
to perform a task efficiently.
These courses are job focused and provide various technical skills related to the
development of full-stack applications, hybrid applications, database
applications, mobile applications, and many others. This helps an individual to
perform well when dealing with complex projects, vendors, and multiplatform
environment.
To enhance the confidence level of an individual.
The curriculum of these courses is designed in such a way that it includes all
practical skills to be used at the workplace. When an individual has prior
knowledge of his subject area it helps him to perform much more confidently
and efficiently at workplace.
It provides training on designing, development, deployment, testing, and
documentation on the real-time projects and applies effectively into their work
environments. This assures employers about the capabilities of an employee that
he/she can successfully complete a job.
It provides detailed knowledge and skills required to perform real-world job
responsibilities.
Chapter 2
ABOUT THE COMPANY
This chapter details on the products, services, and organizational details of Ekathva
Innovations Pvt. Ltd. The milestones and departmental subdivisions are also explored.
Initiatives of CIE
JNNRIC: JNNCE Research & Innovation Centre aims to nurture innovation and
encourageentrepreneurial talents among students, faculty and people of the region, and to
facilitate inter-disciplinary research and coordinates with Incubation Center to bring up
start-ups and promote budding entrepreneurs. JNNRIC might include research proposals
addressingthe Agricultural Technology, Renewable Energy and Energy Conservation
System ICT for Socially relevant problems. JNNRIC will assist students.
Faculty, staff and students to boost the research and Innovation by way of funding to
a certain extent (seed money) every year as shown in Table 2.1
JNNCART: Centre for Agriculture & Rural Technology, a Centre for Appropriate and
Agricultural Technologies was setup at JNNCE with the objective of serving farming
community and other people of the Malnad region. Students will be motivated to address
problems faced by the farmers through innovative, cost effective farming implement part
of their project work as prescribed in academic curriculum.
CART nurtures innovation, and encourages entrepreneurial talents among students, faculty
and people of the region to help agricultural needs of the farmers. It facilitates inter-
disciplinary research and coordinates with incubation centre to bring starts-ups and budding
entrepreneurs.
CART aims to Encourage students and faculty for innovation, idea generation and
product development, provide seed fund to transform an idea into a product, Arrange
workshops forstudents to create awareness in the field of agri-based entrepreneurship, help
with the patenting process, Inspire and support staff and students to achieve their potential
and meet the challenges of society, Facilitate development of at least two innovative
products that are socially relevant. The five products selected and executed for the year
2018-19 are
1. Arecanut Plucker cum Sprayer
2. Multipurpose Hybrid Sprayer
3. Mini Trencher Trenching Machine
4. Hydrophobic sand to combat water scarcity in irrigation
5. Trenching Machine
Intellectual Property Cell (IP Cell): In association with KSCST, VTPC and Inova Tree,
CIE JNNCE is working towards establishing an IP Cell to provide all required information
& guidance on IPR to Students, Alumni, Faculty, Research Scholars, Innovators, Startups,
Companies, Industrialists, Academic Institutions & Universities in and around
Shivamogga. Entrepreneurship Cell (E-Cell): In association with E-Cell IIT Madras, CIE
JNNCE is working towards establishing an E-Cell with the objective to develop spirit of
Entrepreneurship among the students, to motivate students towards self-employment and
entrepreneurship, to blend technical skills of students with entrepreneurial skills to convert
their innovative ideas into enterprise. Activities of this cell include Conducting Awareness
Programs, Skill Development Programs, Workshops, Business Plan Competitions, Boot
Camps, Entrepreneurial Talks, Mentoring Students, taking up innovative projects,
assisting in getting financial support, Company Incorporation, IPR etc., for Startups.
Technology Activities & Programs (TAP): A club of passion driven young students
excelling together, either be it in the process of creating innovations, be it being active &
rebellious dreamers in turning real time challenges prevailing in academics & to develop
an individual in all possible ways by learning & sharing the skillsets. TAP is a knowledge
sharing & knowledge gaining platform for all the interested students from
NAIN Creative Club: NAIN Creative Club, an initiative of NAIN Centre was started on
23rd September 2017 to provide a open platform for students to learn, excel & train
students by conducting workshops & Seminars on various cutting edge technologies &
languages. Club supports inter-departmental activities, which ignites the students to think
out of box and helps to gain & explore creativity.
• Sunrise Digital Media Development Centre by Sunrise Digital Media Pvt. Ltd.
Many other Innovators, Project Teams, Startups, MSMEs & Companies are in
discussions and in pipeline to setup Startups, Development Centers & Centers of
Excellence at JNNCE under CIE. CIE also is in the process of establishingJNNCE
Research Park with the objective of pursuing research in technologies.
Members of CIE
1. Mr. Arun Kumar, Assistant Professor MCA, Project Manager, Center for
Innovation & Centre,Jawaharlal Nehru New College of Engineering, Shivamogga
3. Dr. Manjunath P Prof. Dean Academics, Dept. of ECE College Coordinator, NAIN
Centre
4. Dr. E Basavaraj Professor, Dept. Of Mechanical Engineering, Co-Ordinator,
JNNCART
5. Dr. Karthika B S, Assoc. Prof. and Head, Dept. of Civil Engineering, Convener,
JNNRIC
They are currently working on a Embedded Product which is under patent process
and on Information Technology services like Website Development, App Development
and Customized Software.
Chapter 3
TASKS PERFORMED
Technical Skills
Technical skills are the specialized knowledge and expertise required to perform
specific tasks and use specific tools and programs in real world situations. Diverse technical
skills are required in just about every field and industry, from IT and business administration
to health care and education.
Overview of AI
According to the father of Artificial Intelligence, John McCarthy, it is “The science
and engineering of making intelligent machines, especially intelligent computer
programs”.Artificial Intelligence is a way of making a computer, a computer-controlled
robot, or asoftware think intelligently, in the similar manner the intelligent humans
think. AI isaccomplished by studying how human brain thinks, and how humans learn,
decide, andwork while trying to solve a problem, and then using the outcomes of this study
as a basisof developing intelligent software and systems.
Goals of AI:
To create an expert System: The systems which exhibit intelligent behavior, learn,
demonstrate, explain, and advise its users.
To implement Human Intelligence in Machines: Creating systems that understand,
think, learn, and behave like humans.
Applications of AI
Gaming − AI plays crucial role in strategic games such as chess, poker, tic-tac- toe,
etc., where machine can think of large number of possible positions based on
heuristic knowledge.
Natural Language Processing − It is possible to interact with the computer that
understands natural language spoken by humans.
Expert Systems − There are some applications which integrate machine, software,
These machines can use stored data for a limited time period only.
Self-driving cars are one of the best examples of Limited Memory systems.
These cars can store the recent speed of nearby cars, the distance of other
cars, the speed limit, and other information to navigate the road.
3. Theory of Mind:
Theory of Mind AI should understand the human emotions, people, beliefs,
and be able to interact socially like humans.
This type of AI machines is still not developed, but researchers are making
lots of efforts and improvement for developing such AI machines.
4. Self-Awareness:
Self-Awareness AI is the future of Artificial Intelligence. These machines
will be super intelligent and will have their own consciousness, sentiments,
and self-awareness.
These machines will be smarter than the human mind.
Self-Awareness AI does not exist still and it is a hypothetical concept.
CNN
A convolutional neural network (CNN or convnet) is a subset of machine learning. It
is one of the various types of artificial neural networks which are used for different
applications and data types. A CNN is a kind of network architecture for deep learning
algorithms and is specifically used for image recognition and tasks that involve the processing
of pixel data. There are other types of neural networks in deep learning, but for identifying
and recognizing objects, CNNs are the network architecture of choice. This makes them
highly suitable for computer vision (CV) tasks and for applications where object recognition
is vital, such as self- driving cars and facial recognition.
Soft Skills
The following soft skills were acquired during four weeks of internship.
Time Management: Time management skills are those that help us use our time
effectively and achieve desired results. Time management skills can help you
allocate your time properly and accomplish tasks efficiently. Important skills related
to successful time management skills include Organization, prioritization, Goal
setting, Communication, Planning, Delegation, Stress management.
Personality Development: Personality development refers to how the organized
Experiences
From my internship at Ekathva innovations, I was able to get a better understanding of
technical skills. The lessons that I have learnt from my supervisor and cooperating mentors
have made be confident that I will continue to grow and develop professionally and in my
personal endeavors. I learnt about many trending topics of which industries are using in a
very efficient way. I enjoyed implementing those skills that I have learnt and that has
boosted my confidence to work on projects individually. Overall, I found my internship
experience to be positive, and I’m sure I will be able to use the skills I learned in my career
later.
Chapter 4
REFLECTION NOTES
Assignments
List of assignments:
1. Write python program to convert phone number to word but while converting repeated
like 2 or 3 should be converted to double or triple. Example phone number 9900923050
should be converted as double nine double zero two three zero five zero.
ph_no=input("Enter phone number:")
if(len(ph_no)!=10):
print("Please enter 10 digits")
else:
d=1
k=0
for i in range(10):
if(k>0 or k>1):
k=k-1
continue
if(i<=8):
while(ph_no[i]==ph_no[i+1]):
d=d+1
k=k+1
if(i<8):
i=i+1
else:
break
while(d>3):
d=d-1
k=k-1
if(d==2):
print("Double",end=" ")
d=1
if(d==3):
print("Triple",end=" ")
d=1
if(ph_no[i]=="1"):
print("one",end=" ")
if(ph_no[i]=="2"):
print("two",end=" ")
if(ph_no[i]=="3"):
print("three",end=" ")
if(ph_no[i]=="4"):
print("four",end=" ")
if(ph_no[i]=="5"):
print("five",end=" ")
if(ph_no[i]=="6"):
print("six",end=" ")
if(ph_no[i]=="7"):
print("seven",end=" ")
if(ph_no[i]=="8"):
print("eight",end=" ")
if(ph_no[i]=="9"):
print("nine",end=" ")
if(ph_no[i]=="0"):
print("zero",end=" ")
Output:
2. Write a class neural network and instantiate with attributes number of inputs, number of
outputs and number of outputs. Define a method model with parameters with weights and
bias and return inputs*weights + bias. Instantiate this class with at least 3 objects.
class neuralNetwork:
numer_of_inputs=0
number_of_outputs=0
def model(self,weigths,bais):
return self.numer_of_inputs*weigths+bais
obj1=neuralNetwork(10,10)
obj2=neuralNetwork(20,20)
obj3=neuralNetwork(30,30)
print(obj1.model(15,7))
print(obj2.model(10,8))
print(obj3.model(12,6
3. Create a one dimensional numpy array [10,9,-2,3,16,2,11] and compute median of the
same using various numpy functions. Don’t use any loops.
import numpy as np
arr=np.array([10,9,2,3,16,2,11)
med=np.median (arr)
print(med)
Output:
9.0
import numpy as np
arr=np.array([1,4,3,2,1,6,4,2,3]).reshape(3,3)
d=((arr[0][0])*((arr[1][1]*arr[2][2])-(arr[1][2]*arr[2][1])))
d-=((arr[0][1])*((arr[1][0]*arr[2][2])-(arr[1][2]*arr[2][0])))
d+=((arr[0][2])*((arr[1][0]*arr[2][1])-(arr[1][1]*arr[2][0])))
print(d)
Output:
63
5. Create a uniformly spaced array of 24 elements from 5 to 60. Reshape to 4X6. Create a
Output:
Uniformly spaced array elements are :
[ 5 7 9 12 14 16 19 21 24 26 28 31 33 36 38 40 43 45 48 50 52 55 57 60]
[[False False True True False False]
[False True True False False False]
[ True True False False False True]
[ True False False False True True]]
Masked elements are : [ 9 12 21 24 33 36 45 48 57 60]
Also find its derivative for x=[-3,-2,-1,0,1,2,3] and plot graphs of X vs f(X) and X vs f’(X)
Output:
7. Download lena.jpg from the class room and upload to Google colab. Then process the image
into a single torch variable. For each channel, find out the frequency of occurrence of each pixel
value and display 2 top pixels who has largest frequency of occurrence. [Use kornia] Where n -is
the number of pixels, p(xi) is pixel value of ith pixel
import kornia as K
import cv2
import torch
import numpy as np
tensor_image = img_tensor.float()
pixel_frequencies = []
channel = tensor_image[channel_idx]
pixel_frequencies.append(frequencies)
frequencies = pixel_frequencies[channel_idx]
print(f"Frequency {frequencies[idx]}")
Output:
Channel 1: Top 5 Pixel Values:
Pixel Value 0:
Frequency 262032
Pixel Value 1:
Frequency 112
Pixel Value 175:
Frequency 0
Pixel Value 161:
Frequency 0
Pixel Value 174:
Frequency 0
Channel 2: Top 5 Pixel Values:
Pixel Value 0:
Frequency 262144
Pixel Value 175:
Frequency 0
Pixel Value 161:
Frequency 0
Pixel Value 174:
Frequency 0
Pixel Value 173:
Frequency 0
8. Create a batch of 3 flower images (download flower images from internet) and report which
image has highest normalization range
import cv2
import numpy as np
image_paths = ['/content/sample_data/i1.jpg', '/content/sample_data/i2.jpg', '/content/sample_data/i3.jpg']
max_range = -1
max_range_image = None
for image_path in image_paths:
image = cv2.imread(image_path)
image = image.astype(np.float32) / 255.0
channel_ranges = np.ptp(image, axis=(0, 1))
total_range = np.sum(channel_ranges)
if total_range > max_range:
max_range = total_range
max_range_image = image_path
print(f"The image with the highest normalization range is {max_range_image} with a total range of
{max_range:.4f}.")
Output:
The image with the highest normalization range is /content/sample_data/i1.jpg with a total range of
3.0000.
Project Overview
What we are going to do here is just one alternative which we can categorize as a vision-
based fall detection system. The objective is to build model which is able to detect falls from
just a simple plain video. The most of this project is based on and credited to this paper, Real-
time Vision-based Fall Detection with Motion History Images and Convolutional Neural
Networks.
CNN MODEL:
A Convolutional Neural Network (CNN) is a type of deep learning architecture
commonly used for tasks involving image recognition, classification, and segmentation.
CNNs use convolutional layers to extract features from input images. A CNN model
consists of convolutional layer, pooling layer and fully connected layer.
Convolutional Layers: Convolutional layers, the fundamental components of CNNs,
utilize learnable filters (kernels) to extract features from input images, detecting patterns
like edges, textures, or shapes.
Pooling Layers: Pooling layers are commonly employed following convolutional
layers to decrease spatial dimensions and computational complexity. By employing
operations such as max-pooling or average-pooling, pooling layers aggregate information
from neighboring pixels.
Fully Connected Layers: Fully connected layers serve as traditional neural network
layers in which each neuron is interconnected with every neuron in the preceding and
succeeding layers. These layers play a crucial role in taking the high-level featuresextracted
by convolutional and pooling layers and mapping them to the desired output classes.
As depicted in the figure 4.2, a Convolutional Neural Network (CNN) with three
layers illustrates the sequential flow of operations crucial for image analysis and
classification. The initial convolutional layer employs learnable filters to extract intricate
patterns like edges, textures, and shapes from the input image. Following this, a pooling
layer reduces the spatial dimensions and computational complexity by aggregating
information from neighboring pixels through operations such as max-pooling or average-
pooling. Finally, the fully connected layer serves as the core of classification, where
high-level features gleaned from previous layers are mapped to the desired output
classes. This streamlined architecture captures the essence of feature extraction, spatial
reduction, and classification, essential for effective image recognition and segmentation
tasks in CNNs.
Implementation
The implementation steps for the Fall Detection in Deep Learning in PyTorch are as
follows:
1. Dataset Creation and Preprocessing:
The process begins with loading the dataset comprising images that exhibit various
images. These images may be sourced from diverse sources, like Kaggle/Github. Once
the dataset undergoes preprocessing to extract relevant image features.
Create Dataset
data_dir = f'{root}/dataset'
batch_size = 32
transform = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(), # convert 1 to 3 channels
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
train_sizes = len(train_dataset)
class_names = train_dataset.classes
val_sizes = len(val_dataset)
Create Model
class FDNet(nn.Module):
def _init_(self, out_features=2):
super(FDNet, self)._init_()
mnet = models.mobilenet_v2(pretrained=True)
for name, param in mnet.named_parameters():
if("bn" not in name):
param.requires_grad_(False)
in_features = mnet.classifier[1].in_features
mnet.classifier = nn.Sequential(
nn.Dropout(p=0.2, inplace=False),
nn.Linear(in_features,500),
nn.ReLU(),
nn.Dropout(),
nn.Linear(500, out_features))
self.mnet = mnet
return features
2. Dataset Splitting:
The dataset is split into training and testing datasets at the time of downloading the
dataset from Kaggle/Github.
3. Model Training:
For Fall Detection classification, a Convolutional Neural Network (CNN)
architecture is selected due to its effectiveness in extracting hierarchical features from
images. The CNN comprises multiple layers, including convolutional, pooling, and fully
connected layers, which collectively learn discriminative representations from the input
images. During training, the model learns to optimize its parameters by iteratively
adjusting them to minimize a predefined loss function, typically using techniques like
backpropagation and gradient descent.
model.eval()
num_correct = 0
num_examples = 0
for batch in val_loader:
inputs, targets = batch
inputs = inputs.to(device)
output = model(inputs)
targets = targets.to(device)
loss = loss_fn(output,targets)
print('Epoch: {}, Training Loss: {:.2f}, Validation Loss: {:.2f}, accuracy = {:.2f}'.format(epoch,
training_loss,
valid_loss, num_correct / num_examples))
4. Model Evaluation:
Following the training phase, the performance of the trained model is evaluated
using the testing dataset. The testing dataset contains unseen data samples that were not
used during training, providing an unbiased assessment of the model's generalization
ability. The model's predictions on the testing dataset are compared against the ground
truth labels to assess its accuracy and effectiveness in identifying vegetable features.
test_sizes = len(test_dataset)
4. Accuracy Calculation:
The accuracy of the trained model is calculated by determining the ratio of correctly
classified samples to the total number of samples in the testing dataset. This metric
provides a quantitative measure of the model's performance in accurately identifying
different levels of Fall Detection based on the extracted facial features. A higher
accuracy indicates a more reliable and effective drowsiness detection model, capable of
making accurate predictions in real-world scenarios.
model.eval()
num_correct = 0
num_examples = 0
for batch in test_dataloader:
inputs, targets = batch
inputs = inputs.to(device)
outputs = model(inputs)
outputs = torch.max(F.softmax(outputs, dim=1), dim=1)[1]
targets = targets.to(device)
correct = torch.eq(outputs, targets).view(-1)
num_correct += torch.sum(correct).item()
num_examples += correct.shape[0]
The model was trained and evaluated using large dataset of images. The dataset was
categorised into training and testing datasets. The Convolution Neural Network (CNN) was
finely-tuned on the datasets using techniques of Deep Learning. The layers of the model were
trained using datasets.
Chapter 5
CONCLUSION
Fall detection is a major concern among healthcare sector since it leads to both physical and
metal damage to people, especially the elderly. As our society is turning into aging society, it is
becoming even more concerned. Today, to prevent it, there are many technologies being
developed. In conclusion, AIML-based human fall detection represents a significant step
forward in ensuring the safety and well-being of individuals. Through innovation, collaboration,
and a commitment to leveraging technology for good, we have developed a solution that has the
potential to positively impact lives and communities around the world. As we look to the future,
the potential applications of AIML-based fall detection are vast and diverse. From elderly care
to industrial safety, there exists a wide range of scenarios where our system can make a
meaningful impact in preventing accidents and saving lives.
BIBLIOGRAPHY
[1] https://numpy.org
[2] https://pytorch.org
[3] https://numpy.org/learn
[4] https://web.mit.edu/dvp/Public/numpybook.pdf
[5] https://isip.piconepress.com/courses/temple/ece_4822/resources/books/Deep-Learning-with-
PyTorch.pdf
[6] https://github.com/nithiroj/Fall-Detection-PyTorch.git