Professional Documents
Culture Documents
BACHELOR OF TECHNOLOGY
In
by
Dr.M.Thirupathi
ASSOCIATE PROFESSOR
NOVEMBER - 2023
UGC Autonomous
Affiliated to JNTUH, Approved by AICTE,
Accredited by NBA & NAAC A+, ISO 9001:2008 Certified
Dhulapally, Secunderabad - 500 100
Certificate
This is to certify that the project entitled “Real-time Cognitive Analysis and
Prediction of Human Behaviour in Collaborative Environments ” is
being submitted by K.Mahendar Reddy (20K81A0492), S.Nithin Reddy (20K81A04A6),
V.Naveen Reddy (20K81A04B8), Y.Chaitanya Reddy (20K81A04B9) in fulfilment of the
requirement for the award of degree of BACHELOR OF TECHNOLOGY IN
ELECTRONICS AND COMMUNICATION ENGINNERING is recorded of bonafide work
carried out by them. The result embodied in this report have been verified and found
satisfactory.
Place:
DECLARATION
The satisfaction and euphoria that accompanies the successful completion of any task would be
incomplete without the mention of the people who made it possible and whose encouragement and
guidance have crowded our efforts with success.
First and foremost, we would like to express our deep sense of gratitude and indebtedness to our
College Management for their kind support and permission to use the facilities available in the
Institute.
We especially would like to express our deep sense of gratitude and indebtedness to
Dr. P. SANTOSH KUMAR PATRA, Group Director, St. Martin’s Engineering College Dhulapally,
for permitting us to undertake this project.
We wish to record our profound gratitude to Dr. M. SREENIVAS RAO, Principal, St. Martin’s
Engineering College, for his motivation and encouragement.
We are also thankful to Dr. B. HARI KRISHNA, Head of the Department, Electronics and
communication engineering, St. Martin’s Engineering College, Dhulapally, Secunderabad, for his
support and guidance throughout our project as well as Project Coordinator Mr.Venkanna Mood ,
associate Professor, Dr.M.Thirupathi , professor, department of Electronics and Communication
Engineering for their valuable support.
We would like to express our sincere gratitude and indebtedness to our project supervisor
Dr.M.Thirupathi , professor, electronics and communication engineering , St. Martins Engineering
College, Dhulapally, for his support and guidance throughout our project.
Finally, we express thanks to all those who have helped us successfully completing this project.
Furthermore, we would like to thank our family and friends for their moral support and encouragement.
We express thanks to all those who have helped us in successfully completing the project.
Abstract v
CHAPTER 1 INTRODUCTION 01-05
1.1 Overview 01-02
1.2 Research Motivation 02-03
1.3 Problem Statement 03-04
1.4 Applications 04-05
ii
i
ii
01 Performance comparison 52
iv
ABSTRACT
v
CHAPTER 1
INTRODUCTION
1.1 Overview
One key aspect of this endeavor involves analyzing individual and group dynamics.
Psychologically, understanding human motivation, personality traits, and cognitive
biases helps in predicting how individuals might react or contribute in a collaborative
setting. Additionally, sociological factors like culture, norms, and social hierarchies
play a significant role in shaping group behaviour. These insights are often combined
with data-driven approaches, such as machine learning and big data analytics, to
develop predictive models. These models can anticipate how individuals and groups
might respond to different situations, tasks, or incentives.
Moreover, technology has played a pivotal role in this domain. With the advent of
digital platforms and the proliferation of social media, vast amounts of data are
generated, offering valuable insights into human behaviour. Predictive algorithms can
leverage this data to anticipate user preferences, social interactions, and decision-
making patterns. In collaborative work environments, this can translate into better
team composition, task assignment, and conflict resolution strategies.
Secondly, predicting human behaviour is crucial for resource allocation and decision-
making. In organizations and societies, resources are often limited, and decisions need
to be made about how to allocate them optimally. Predictive models can help in
forecasting demand, assessing the impact of various resource allocation strategies, and
making informed decisions about investments, budgets, and resource distribution.
Additionally, in the digital age, online platforms and social media have become
integral parts of our lives. Predicting user behaviour in these virtual collaborative
environments is crucial for businesses, advertisers, and content creators seeking to
tailor their offerings and experiences to individual preferences. This drives user
engagement and revenue generation.
The complexity of predicting human behaviour arises from the multifaceted nature of
individuals and groups. Psychological variables, including personality traits, cognitive
biases, and motivations, interact with sociological factors such as cultural norms,
group dynamics, and power structures. In parallel, the digital age has introduced vast
datasets generated by online interactions, further complicating the problem.
Navigating this complexity is essential, as it has direct implications for optimizing
team dynamics, resource allocation, and decision-making processes, which can
significantly impact productivity, innovation, and overall societal well-being.
Moreover, ethical concerns loom large in this context. The power to predict and
influence human behaviour can be misused, leading to privacy violations, unfair
manipulation, and exacerbation of existing biases. Addressing these ethical challenges
is integral to the problem statement, requiring the development of responsible
predictive models and guidelines to ensure equitable and transparent use in
collaborative environments.
In summary, the problem statement revolves around the need to understand and
predict human behaviour within collaborative environments, considering the intricate
3
interplay of psychological, sociological, and technological factors. This understanding
must be leveraged to enhance productivity, fairness, and ethical integrity in these
contexts. Balancing the complexity of human behaviour with ethical considerations
constitutes a central challenge in this research domain.
1.4 Applications
4
provide more personalized and engaging content, resulting in longer user
engagement and higher ad revenue.
Smart Cities: In the context of smart cities, predicting human behaviour can
optimize traffic management, energy consumption, and public services. This
leads to more sustainable and efficient urban environments.
5
CHAPTER 2
LITERATURE SURVEY
Tang et al. investigated and compared the cycle time, waiting time, and operators’
subjective preference of a human–robot collaborative assembly task when three
handover prediction models were applied: traditional method-time measurement
(MTM), Kalman filter, and trigger sensor approaches. The Kalman filter prediction
model could adjust the handover timing according to the operator’s current speed and
reduce the waiting time of the robot and operator, thereby improving the subjective
preference of the operator. Moreover, the trigger sensor method’s inherent flexibility
concerning random single interruptions on the operator’s side earned it the highest
scores in the satisfaction assessment.
6
Bianchi et al. presented an innovative HAR system, exploiting the potential of
wearable devices integrated with the skills of deep learning techniques, with the aim
of recognizing the most common daily activities of a person at home. The designed
wearable sensor embedded an inertial measurement unit (IMU) and a Wi-Fi section to
send data on a cloud service and to allow direct connection to the Internet through a
common home router so that the user themselves could manage the installation
procedure. The system is conceived for daily activity monitor and nine different
activities can be highlighted with an accuracy of 97%.
Nwekw et al. focused to provide in-depth summaries of deep learning methods for
mobile and wearable sensor-based human activity recognition. The review presented
the methods, uniqueness, advantages, and their limitations. This framework not only
categorise the studies into generative, discriminative and hybrid methods but also
highlight their important advantages. Furthermore, the review presented classification
and evaluation procedures and discusses publicly available datasets for mobile sensor
human activity recognition. Finally, this work outlined and explained some challenges
to open research problems that require further research and improvements.
7
Zhou et al. developed an intelligent Autolabeling scheme based on deep Q-network
(DQN) with a newly designed distance-based reward rule which can improve the
learning efficiency in IoT environments. A multisensory based data fusion mechanism
is then developed to seamlessly integrate the on-body sensor data, context sensor data,
and personal profile data together, and a long short-term memory (LSTM)-based
classification method is proposed to identify fine-grained patterns according to the
high-level features contextually extracted from the sequential motion data.
Chen et al. proposed a new deep learning-based approach, i.e., attention based bi-
directional long short-term memory (ABLSTM), for passive human activity
recognition using WiFi CSI signals. The BLSTM is employed to learn representative
features in two directions from raw sequential CSI measurements. Since the learned
features may have different contributions for final activity recognition, this
framework leveraged on an attention mechanism to assign different weights for all the
learned features.
Kong et al. surveyed the complete state-of-the-art techniques in action recognition and
prediction. Existing models, popular algorithms, technical difficulties, popular action
databases, evaluation protocols, and promising future directions are also provided
with systematic discussions.
8
CHAPTER 3
EXISTING SYSTEM
3.1 Disadvantages
ML Model makes decisions based on what it has learnt from the data. As a
result, while ML models may learn from data, they may need some human
interaction in the early stages.
Moreover, its performance is poor with large dataset.
10
CHAPTER 4
PROPOSED SYSTEM
4.1 Overview
step 1: Video to Frame Conversion: In this step, a video stream is converted into
individual frames. Each frame represents a single image captured from the video
at a specific time instance. This process allows the model to analyze and make
predictions based on individual frames, which are then combined to make real-
time predictions.
step 2: Frame Preprocessing: Before feeding the frames into the DLCNN model,
preprocessing is essential to enhance the model's ability to detect patterns and
features. Common preprocessing steps may include:
11
layers for feature extraction, followed by fully connected layers for classification.
Here's a simplified overview of the steps involved in building the model:
Pooling Layers: Pooling layers reduce the spatial dimensions of the feature
maps, helping to focus on the most relevant information.
Fully Connected Layers: These layers provide the final classification based
on the extracted features.
step 4: Model Prediction: After the DLCNN model is trained, it can be used for real-
time prediction of human behaviour. This involves:
The model assigns a behaviour label to each frame based on its learned
patterns and features.
The behaviour labels are typically encoded as numerical values (e.g., 0 for
safe driving, 1 for phone usage, etc.).
The model's output for each frame can be interpreted to determine the
predicted behaviour.
12
In the provided code snippet, a conditional structure is used to map the
numerical predictions (e.g., '0', '1', '2') to human-readable behaviour
descriptions (e.g., 'Safe Driving', 'Using/Talking Phone').
The process of converting a video into individual frames involves breaking down a
video stream into a sequence of static images, where each image represents a single
frame captured at a specific time instance. This is a crucial step in video analysis,
especially for tasks like object detection, behaviour recognition, or any application
that requires analyzing the visual content of a video. Here are the key steps involved
in video to frame conversion:
Video Capture: Open a video file or connect to a video stream (e.g., from a webcam
or surveillance camera) using a video processing library or tool. Popular libraries for
video processing include OpenCV (Open Source Computer Vision Library) in Python
and FFmpeg.
Frame Extraction: Read the video frame by frame. For each frame, which typically
retrieve an image that represents the content of that frame at a specific time.
Frame Storage: Store each frame as a separate image file or in memory as an image
object. Common image formats like JPEG or PNG are often used for storage.
Image preprocessing is a critical step in computer vision and image analysis tasks. It
involves a series of operations to prepare raw images for further processing by
algorithms or neural networks. Here's an explanation of each step in image
preprocessing:
Step 0. Image Read: The first step in image preprocessing is reading the raw image
from a source, typically a file on disk. Images can be in various formats, such as
JPEG, PNG, BMP, or others. Image reading is performed using libraries or functions
specific to the chosen programming environment or framework. The result of this step
is a digital representation of the image that can be manipulated programmatically.
Step 1. Image Resize: Image resize is a common preprocessing step, especially when
working with machine learning models or deep neural networks. It involves changing
the dimensions (width and height) of the image. Resizing can be necessary for several
reasons:
13
Ensuring uniform input size: Many machine learning models, especially
convolutional neural networks (CNNs), require input images to have the same
dimensions. Resizing allows to standardize input sizes.
When resizing, it's essential to maintain the aspect ratio to prevent image distortion.
Typically, libraries like OpenCV or Pillow provide convenient functions for resizing
images.
Step 2. Image to Array: In this step, the image is converted into a numerical
representation in the form of a multidimensional array or tensor. Each pixel in the
image corresponds to a value in the array. The array is usually structured with
dimensions representing height, width, and colour channels (if applicable).
For grayscale images, the array is 2D, with each element representing the intensity of
a pixel. For colour images, it's a 3D or 4D array, with dimensions for height, width,
colour channels (e.g., Red, Green, Blue), and potentially batch size (if processing
multiple images simultaneously).
The conversion from an image to an array allows for numerical manipulation and
analysis, making it compatible with various data processing libraries and deep
learning frameworks like NumPy or TensorFlow.
Step 3. Image to Float32: Most machine learning and computer vision algorithms
expect input data to be in a specific data type, often 32-bit floating-point numbers
(float32). Converting the image array to float32 ensures that the pixel values can
represent a wide range of intensities between 0.0 (black) and 1.0 (white) or sometimes
between -1.0 and 1.0, depending on the specific normalization used.
This step is essential for maintaining consistency in data types and enabling
compatibility with various machine learning frameworks and libraries. It's typically
performed by dividing the pixel values by the maximum intensity value (e.g., 255 for
an 8-bit image) to scale them to the [0.0, 1.0] range.
14
(white) based on a specified threshold. Binarization is commonly used for tasks like
image segmentation, where you want to separate objects from the background.
The process involves setting a threshold value, and then for each pixel in the
grayscale image, if the pixel value is greater than or equal to the threshold, it is set to
1; otherwise, it is set to 0.
Binarization simplifies the image and reduces it to essential information, which can be
particularly useful in applications like character recognition or object tracking, where
you need to isolate regions of interest.
In machine learning data pre-processing, we divide our dataset into a training set and
test set. This is one of the crucial steps of data pre-processing as by doing this, we can
enhance the performance of our machine learning model. Suppose if we have given
training to our machine learning model by a dataset and we test it by a completely
different dataset. Then, it will create difficulties for our model to understand the
correlations between the models. If we train our model very well and its training
accuracy is also very high, but we provide a new dataset to it, then it will decrease the
performance. So we always try to make a machine learning model which performs
well with the training set and also with the test dataset. Here, we can define these
datasets as:
Training Set: A subset of dataset to train the machine learning model, and we already
know the output.
Test set: A subset of dataset to test the machine learning model, and by using the test
set, model predicts the output.
4.5 DLCNN
According to the facts, training and testing of CNN involves in allowing every source
feature via a succession of convolution layers by a kernel or filter, rectified linear unit
(ReLU), max pooling, fully connected layer and utilize SoftMax layer with
classification layer to categorize the objects with probabilistic values ranging from
[ 0 , 1 ]. Convolution layer is the primary layer to extract the features from a source
feature and maintains the relationship between pixels by learning the features of
feature by employing tiny blocks of source data. It’s a mathematical function which
considers two inputs like source feature I ( x , y , d ) where x and y denotes the spatial
15
coordinates i.e., number of rows and columns. d is denoted as dimension of an feature
(here d=3, since the source feature is RGB) and a filter or kernel with similar size of
input feature and can be denoted as F ( k x , k y , d ).
The output obtained from convolution process of input feature and filter has a size of
C ( ( x−k x + 1 ) , ( y−k y +1 ) , 1 ), which is referred as feature map. An example of
convolution procedure is demonstrated in Fig. 2(a). Let us assume an input feature
with a size of 5 ×5 and the filter having the size of 3 ×3 . The feature map of input
feature is obtained by multiplying the input feature values with the filter values as
given in Fig. 2(b).
(a)
(b)
Fig. 4.3: Example of convolution layer process. (a) a feature with size 5 ×5 is
convolving with 3 ×3 kernel. (b) Convolved feature map.
ReLU layer: Networks that utilize the rectifier operation for the hidden layers are
cited as rectified linear unit (ReLU). This ReLU function G(∙) is a simple
computation that returns the value given as input directly if the value of input is
16
greater than zero else returns zero. This can be represented as mathematically using
the function max (∙) over the set of 0 and the input x as follows:
G ( x )=max { 0 , x }
Max pooing layer: This layer mitigates the number of parameters when there are
larger size features. This can be called subsampling or down sampling that mitigates
the dimensionality of every feature map by preserving the important information. Max
pooling considers the maximum element form the rectified feature map.
SoftMax classifier
Generally, SoftMax function is added at the end of the output since it is the place
where the nodes are meet finally and thus, they can be classified. Here, X is the input
of all the models and the layers between X and Y are the hidden layers and the data is
passed from X to all the layers and Received by Y. Suppose, we have 10 classes, and
we predict for which class the given input belongs to. So, for this what we do is allot
each class with a particular predicted output. Which means that we have 10 outputs
corresponding to 10 different class and predict the class by the highest probability.
In Fig. 4.4, and we must predict what is the object that is present in the picture. In the
normal case, we predict whether the crop is A. But in this case, we must predict what
is the object that is present in the picture. This is the place where softmax comes in
handy. As the model is already trained on some data. So, as soon as the picture is
given, the model processes the pictures, send it to the hidden layers and then finally
send to softmax for classifying the picture. The softmax uses a One-Hot encoding
Technique to calculate the cross-entropy loss and get the max. One-Hot Encoding is
17
the technique that is used to categorize the data. In the previous example, if softmax
predicts that the object is class A then the One-Hot Encoding for:
Class A will be [1 0 0]
Class B will be [0 1 0]
Class C will be [0 0 1]
From the diagram, we see that the predictions are occurred. But generally, we don’t
know the predictions. But the machine must choose the correct predicted object. So,
for machine to identify an object correctly, it uses a function called cross-entropy
function. So, we choose more similar value by using the below cross-entropy formula.
In Fig. 4.5, we see that 0.462 is the loss of the function for class specific classifier. In
the same way, we find loss for remaining classifiers. The lowest the loss function, the
better the prediction is. The mathematical representation for loss function can be
represented as: -
18
Fig. 4.6: Example of SoftMax classifier with test data.
CNNs do not require human supervision for the task of identifying important
features.
They are very accurate at image recognition and classification.
Weight sharing is another major advantage of CNNs.
Convolutional neural networks also minimize computation in comparison with
a regular neural network.
CNNs make use of the same knowledge across all image locations.
19
CHAPTER 5
MACHINE LEARNING
Before we look at the details of various machine learning methods, let's start by
looking at what machine learning is, and what it isn't. Machine learning is often
categorized as a subfield of artificial intelligence, but I find that categorization can
often be misleading at first brush. The study of machine learning certainly arose from
research in this context, but in the data science application of machine learning
methods, it's more helpful to think of machine learning as a means of building models
of data.
At the most fundamental level, machine learning can be categorized into two main
types: supervised learning and unsupervised learning.
20
subdivided into classification tasks and regression tasks: in classification, the labels
are discrete categories, while in regression, the labels are continuous quantities. We
will see examples of both types of supervised learning in the following section.
Human beings, at this moment, are the most intelligent and advanced species on earth
because they can think, evaluate, and solve complex problems. On the other side, AI
is still in its initial stage and have not surpassed human intelligence in many aspects.
Then the question is that what is the need to make machine learn? The most suitable
reason for doing this is, “to make decisions, based on data, with efficiency and scale”.
21
consumption of time especially for data acquisition, feature extraction and
retrieval.
3. Lack of specialist persons − As ML technology is still in its infancy stage,
availability of expert resources is a tough job.
4. No clear objective for formulating business problems − Having no clear
objective and well-defined goal for business problems is another key challenge
for ML because this technology is not that mature yet.
5. Issue of overfitting & underfitting − If the model is overfitting or underfitting,
it cannot be represented well for the problem.
6. Curse of dimensionality − Another challenge ML model faces is too many
features of data points. This can be a real hindrance.
7. Difficulty in deployment − Complexity of the ML model makes it quite
difficult to be deployed in real life.
Emotion analysis
Sentiment analysis
Error detection and prevention
Weather forecasting and prediction
Stock market analysis and forecasting
Speech synthesis
Speech recognition
Customer segmentation
Object recognition
Fraud detection
Fraud prevention
Recommendation of products to customer in online shopping
22
Arthur Samuel coined the term “Machine Learning” in 1959 and defined it as a “Field
of study that gives computers the capability to learn without being explicitly
programmed”.
And that was the beginning of Machine Learning! In modern times, Machine
Learning is one of the most popular (if not the most!) career choices. According
to Indeed, Machine Learning Engineer Is The Best Job of 2019 with a 344% growth
and an average base salary of $146,085 per year.
But there is still a lot of doubt about what exactly is Machine Learning and how to
start learning it? So, this article deals with the Basics of Machine Learning and also
the path you can follow to eventually become a full-fledged Machine Learning
Engineer. Now let’s get started!!!
This is a rough roadmap you can follow on your way to becoming an insanely
talented Machine Learning Engineer. Of course, you can always modify the steps
according to your needs to reach your desired end-goal!
In case you are a genius, you could start ML directly but normally, there are some
prerequisites that you need to know which include Linear Algebra, Multivariate
Calculus, Statistics, and Python. And if you don’t know these, never fear! You don’t
need a Ph.D. degree in these topics to get started but you do need a basic
understanding.
Both Linear Algebra and Multivariate Calculus are important in Machine Learning.
However, the extent to which you need them depends on your role as a data scientist.
If you are more focused on application heavy machine learning, then you will not be
that heavily focused on maths as there are many common libraries available. But if
you want to focus on R&D in Machine Learning, then mastery of Linear Algebra and
Multivariate Calculus is very important as you will have to implement many ML
algorithms from scratch.
Data plays a huge role in Machine Learning. In fact, around 80% of your time as an
ML expert will be spent collecting and cleaning data. And statistics is a field that
handles the collection, analysis, and presentation of data. So it is no surprise that you
23
need to learn it!!!
Some of the key concepts in statistics that are important are Statistical Significance,
Probability Distributions, Hypothesis Testing, Regression, etc. Also, Bayesian
Thinking is also a very important part of ML which deals with various concepts like
Conditional Probability, Priors, and Posteriors, Maximum Likelihood, etc.
Some people prefer to skip Linear Algebra, Multivariate Calculus and Statistics and
learn them as they go along with trial and error. But the one thing that you absolutely
cannot skip is Python! While there are other languages you can use for Machine
Learning like R, Scala, etc. Python is currently the most popular language for ML. In
fact, there are many Python libraries that are specifically useful for Artificial
Intelligence and Machine Learning such as Keras, TensorFlow, Scikit-learn, etc.
So if you want to learn ML, it’s best if you learn Python! You can do that using
various online resources and courses such as Fork Python available Free on
GeeksforGeeks.
Now that you are done with the prerequisites, you can move on to actually learning
ML (Which is the fun part!!!) It’s best to start with the basics and then move on to the
more complicated stuff. Some of the basic concepts in ML are:
24
Prediction – Once our model is ready, it can be fed a set of inputs to which it
will provide a predicted output(label).
Machine Learning can review large volumes of data and discover specific trends and
patterns that would not be apparent to humans. For instance, for an e-commerce
website like Amazon, it serves to understand the browsing behaviours and purchase
histories of its users to help cater to the right products, deals, and reminders relevant
to them. It uses the results to reveal relevant advertisements to them.
With ML, you don’t need to babysit your project every step of the way. Since it
means giving machines the ability to learn, it lets them make predictions and also
improve the algorithms on their own. A common example of this is anti-virus
softwares; they learn to filter new threats as they are recognized. ML is also good at
recognizing spam.
3. Continuous Improvement
25
As ML algorithms gain experience, they keep improving in accuracy and efficiency.
This lets them make better decisions. Say you need to make a weather forecast model.
As the amount of data you have keeps growing, your algorithms learn to make more
accurate predictions faster.
Machine Learning algorithms are good at handling data that are multi-dimensional
and multi-variety, and they can do this in dynamic or uncertain environments.
5. Wide Applications
You could be an e-tailer or a healthcare provider and make ML work for you. Where
it does apply, it holds the capability to help deliver a much more personal experience
to customers while also targeting the right customers.
1. Data Acquisition
Machine Learning requires massive data sets to train on, and these should be
inclusive/unbiased, and of good quality. There can also be times where they must wait
for new data to be generated.
ML needs enough time to let the algorithms learn and develop enough to fulfill their
purpose with a considerable amount of accuracy and relevancy. It also needs massive
resources to function. This can mean additional requirements of computer power for
you.
3. Interpretation of Results
Another major challenge is the ability to accurately interpret results generated by the
algorithms. You must also carefully choose the algorithms for your purpose.
4. High error-susceptibility
Machine Learning is autonomous but highly susceptible to errors. Suppose you train
an algorithm with data sets small enough to not be inclusive. You end up with biased
predictions coming from a biased training set. This leads to irrelevant advertisements
being displayed to customers. In the case of ML, such blunders can set off a chain of
errors that can go undetected for long periods of time. And when they do get noticed,
26
it takes quite some time to recognize the source of the issue, and even longer to
correct it.
CHAPTER 6
SOFTWARE ENVIRONMENT
The biggest strength of Python is huge collection of standard library which can be
used for the following –
Machine Learning
GUI Applications (like Kivy, Tkinter, PyQt etc. )
Web frameworks like Django (used by YouTube, Instagram, Dropbox)
Image processing (like Opencv, Pillow)
Web scraping (like Scrapy, BeautifulSoup, Selenium)
Test frameworks
Multimedia
27
6.2 Advantages of Python
1. Extensive Libraries
Python downloads with an extensive library and it contain code for various purposes
like regular expressions, documentation-generation, unit-testing, web browsers,
threading, databases, CGI, email, image manipulation, and more. So, we don’t have to
write the complete code for that manually.
2. Extensible
As we have seen earlier, Python can be extended to other languages. You can write
some of your code in languages like C++ or C. This comes in handy, especially in
projects.
3. Embeddable
4. Improved Productivity
5. IOT Opportunities
Since Python forms the basis of new platforms like Raspberry Pi, it finds the future
bright for the Internet Of Things. This is a way to connect the language with the real
world.
When working with Java, you may have to create a class to print ‘Hello World’. But
in Python, just a print statement will do. It is also quite easy to learn, understand, and
code. This is why when people pick up Python, they have a hard time adjusting to
other more verbose languages like Java.
7. Readable
28
Because it is not such a verbose language, reading Python is much like reading
English. This is the reason why it is so easy to learn, understand, and code. It also
does not need curly braces to define blocks, and indentation is mandatory. This
further aids the readability of the code.
8. Object-Oriented
Like we said earlier, Python is freely available. But not only can you download
Python for free, but you can also download its source code, make changes to it, and
even distribute it. It downloads with an extensive collection of libraries to help you
with your tasks.
10. Portable
When you code your project in a language like C++, you may need to make some
changes to it if you want to run it on another platform. But it isn’t the same with
Python. Here, you need to code only once, and you can run it anywhere. This is called
Write Once Run Anywhere (WORA). However, you need to be careful enough not to
include any system-dependent features.
11. Interpreted
Lastly, we will say that it is an interpreted language. Since statements are executed
one by one, debugging is easier than in compiled languages.
Any doubts till now in the advantages of Python? Mention in the comment section.
1. Less Coding
Almost all of the tasks done in Python requires less coding when the same task is
done in other languages. Python also has an awesome standard library support, so you
29
don’t have to search for any third-party libraries to get your job done. This is the
reason that many people suggest learning Python to beginners.
2. Affordable
The 2019 Github annual survey showed us that Python has overtaken Java in the most
popular programming language category.
Python code can run on any machine whether it is Linux, Mac or Windows.
Programmers need to learn different languages for different jobs but with Python, you
can professionally build web apps, perform data analysis and machine learning,
automate things, do web scraping and also build games and powerful visualizations. It
is an all-rounder programming language.
So far, we’ve seen why Python is a great choice for your project. But if you choose it,
you should be aware of its consequences as well. Let’s now see the downsides of
choosing Python over another language.
1. Speed Limitations
We have seen that Python code is executed line by line. But since Python is
interpreted, it often results in slow execution. This, however, isn’t a problem unless
speed is a focal point for the project. In other words, unless high speed is a
requirement, the benefits offered by Python are enough to distract us from its speed
limitations.
The reason it is not so famous despite the existence of Brython is that it isn’t that
secure.
30
3. Design Restrictions
As you know, Python is dynamically typed. This means that you don’t need to declare
the type of variable while writing the code. It uses duck-typing. But wait, what’s that?
Well, it just means that if it looks like a duck, it must be a duck. While this is easy on
the programmers during coding, it can raise run-time errors.
Compared to more widely used technologies like JDBC (Java DataBase Connectivity)
and ODBC (Open DataBase Connectivity), Python’s database access layers are a bit
underdeveloped. Consequently, it is less often applied in huge enterprises.
5. Simple
No, we’re not kidding. Python’s simplicity can indeed be a problem. Take my
example. I don’t do Java, I’m more of a Python person. To me, its syntax is so simple
that the verbosity of Java code seems unnecessary.
This was all about the Advantages and Disadvantages of Python Programming
Language.
What do the alphabet and the programming language Python have in common? Right,
both start with ABC. If we are talking about ABC in the Python context, it's clear that
the programming language ABC is meant. ABC is a general-purpose programming
language and programming environment, which had been developed in the
Netherlands, Amsterdam, at the CWI (Centrum Wiskunde &Informatica). The
greatest achievement of ABC was to influence the design of Python. Python was
conceptualized in the late 1980s. Guido van Rossum worked that time in a project at
the CWI, called Amoeba, a distributed operating system. In an interview with Bill
Venners1, Guido van Rossum said: "In the early 1980s, I worked as an implementer
on a team building a language called ABC at Centrum voor Wiskunde en Informatica
(CWI). I don't know how well people know ABC's influence on Python. I try to
mention ABC's influence because I'm indebted to everything I learned during that
project and to the people who worked on it. "Later on in the same Interview, Guido
van Rossum continued: "I remembered all my experience and some of my frustration
with ABC. I decided to try to design a simple scripting language that possessed some
of ABC's better properties, but without its problems. So I started typing. I created a
31
simple virtual machine, a simple parser, and a simple runtime. I made my own version
of the various ABC parts that I liked. I created a basic syntax, used indentation for
statement grouping instead of curly braces or begin-end blocks, and developed a small
number of powerful data types: a hash table (or dictionary, as we call it), a list,
strings, and numbers."
Guido Van Rossum published the first version of Python code (version 0.9.0) at
alt.sources in February 1991. This release included already exception handling,
functions, and the core data types of list, dict, str and others. It was also object
oriented and had a module system.
Python version 1.0 was released in January 1994. The major new features included in
this release were the functional programming tools lambda, map, filter and reduce,
which Guido Van Rossum never liked. Six and a half years later in October 2000,
Python 2.0 was introduced. This release included list comprehensions, a full garbage
collector and it was supporting unicode. Python flourished for another 8 years in the
versions 2.x before the next major release as Python 3.0 (also known as "Python
3000" and "Py3K") was released. Python 3 is not backwards compatible with Python
2.x. The emphasis in Python 3 had been on the removal of duplicate programming
constructs and modules, thus fulfilling or coming close to fulfilling the 13th law of the
Zen of Python: "There should be one -- and preferably only one -- obvious way to do
it."Some changes in Python 7.3:
6.6 Purpose
32
We demonstrated that our approach enables successful segmentation of intra-retinal
layers—even with low-quality images containing speckle noise, low contrast, and
different intensity ranges throughout—with the assistance of the ANIS feature.
6.7 Python
Python also acknowledges that speed of development is important. Readable and terse
code is part of this, and so is access to powerful constructs that avoid tedious
repetition of code. Maintainability also ties into this may be an all but useless metric,
but it does say something about how much code you have to scan, read and/or
understand to troubleshoot problems or tweak behaviours. This speed of development,
the ease with which a programmer of other languages can pick up basic Python skills
and the huge standard library is key to another area where Python excels. All its tools
have been quick to implement, saved a lot of time, and several of them have later been
patched and updated by people with no Python background - without breaking.
TensorFlow
TensorFlow is a free and open-source software library for dataflow and differentiable
programming across a range of tasks. It is a symbolic math library and is also used for
machine learning applications such as neural networks. It is used for both research
and production at Google.
33
TensorFlow was developed by the Google Brain team for internal Google use. It was
released under the Apache 2.0 open-source license on November 9, 2015.
NumPy
Besides its obvious scientific uses, NumPy can also be used as an efficient multi-
dimensional container of generic data. Arbitrary datatypes can be defined using
NumPy which allows NumPy to seamlessly and speedily integrate with a wide variety
of databases.
Pandas
Matplotlib
34
plots, histograms, power spectra, bar charts, error charts, scatter plots, etc., with just a
few lines of code. For examples, see the sample plots and thumbnail gallery.
Scikit – learn
Python also acknowledges that speed of development is important. Readable and terse
code is part of this, and so is access to powerful constructs that avoid tedious
repetition of code. Maintainability also ties into this may be an all but useless metric,
but it does say something about how much code you have to scan, read and/or
understand to troubleshoot problems or tweak behaviours. This speed of development,
the ease with which a programmer of other languages can pick up basic Python skills
and the huge standard library is key to another area where Python excels. All its tools
have been quick to implement, saved a lot of time, and several of them have later been
patched and updated by people with no Python background - without breaking.
35
Install Python Step-by-Step in Windows and Mac
There have been several updates in the Python version over the years. The question is
how to install Python? It might be confusing for the beginner who is willing to start
learning Python but this tutorial will solve your query. The latest or the newest
version of Python is version 3.7.4 or in other words, it is Python 3.
Note: The python version 3.7.4 cannot be used on Windows XP or earlier devices.
Before you start with the installation process of Python. First, you need to know about
your System Requirements. Based on your system type i.e. operating system and
based processor, you must download the python version. My system type is a
Windows 64-bit operating system. So the steps below are to install python version
3.7.4 on Windows 7 device or to install Python 3. Download the Python Cheatsheet
here.The steps on how to install Python on Windows 10, 8 and 7 are divided into 4
parts to help understand better.
Step 1: Go to the official site to download and install python using Google Chrome or
any other web browser. OR Click on the following link: https://www.python.org
36
Figure 6.1.Step1 for download python.
Now, check for the latest and the correct version for your operating system.
Step 3: You can either select the Download Python for windows 3.7.4 button in
Yellow Color or you can scroll further down and click on download with respective to
their version. Here, we are downloading the most recent python version for windows
3.7.4
37
Figure 6.3.Step3 for download python.
Step 4: Scroll down the page until you find the Files option.
Step 5: Here you see a different version of python along with the operating system.
To download Windows 32-bit python, you can select any one from the three
options: Windows x86 embeddable zip file, Windows x86 executable installer
or Windows x86 web-based installer.
To download Windows 64-bit python, you can select any one from the three
options: Windows x86-64 embeddable zip file, Windows x86-64 executable
installer or Windows x86-64 web-based installer.
Here we will install Windows x86-64 web-based installer. Here your first part
regarding which version of python is to be downloaded is completed. Now we move
ahead with the second part in installing python i.e. Installation
Note: To know the changes or updates that are made in the version you can click on
the Release Note Option.
38
6.9 Installation of Python
Step 1: Go to Download and Open the downloaded python version to carry out the
installation process.
Step 2: Before you click on Install Now, Make sure to put a tick on Add Python 3.7 to
PATH.
Step 3: Click on Install NOW After the installation is successful. Click on Close.
39
Figure 6.7.Step3 for installation python.
With these above three steps on python installation, you have successfully and
correctly installed Python. Now is the time to verify the installation.
40
Step 3: Open the Command prompt option.
Step 4: Let us test whether the python is correctly installed. Type python –V and press
Enter.
Note: If you have any of the earlier versions of Python already installed. You must
first uninstall the earlier version and then install the new one.
Step 3: Click on IDLE (Python 3.7 64-bit) and launch the program
Step 4: To go ahead with working in IDLE you must first save the file. Click on File >
Click on Save
41
F
igure 6.11.Step4 for checking python IDLE
Step 5: Name the file and save as type should be Python files. Click on SAVE. Here I
have named the files as Hey World.
Step 6: Now for e.g. enter print (“Hey World”) and Press Enter.
You will see that the command given is launched. With this, we end our tutorial on
how to install Python. You have learned how to download python for windows into
your respective operating system.
Note: Unlike Java, Python does not need semicolons at the end of the statements
otherwise it won’t work.
42
CHAPTER 7
SOURCE CODE
import tkinter
import numpy as np
import imutils
import cv2 as cv
import os
main = tkinter.Tk()
main.geometry("800x500")
global cnn_model
global video
43
def loadModel():#load cnn model
global cnn_model
cnn_model = Sequential()
cnn_model.add(Flatten())
cnn_model.load_weights('model/cnn_model.h5')
global video
filename = filedialog.askopenfilename(initialdir="Video")
video = cv.VideoCapture(filename)
44
#track or assess human performance
def humanPerformance():
global cnn_model
while(True):
print(ret)
if ret == True:
cv.imwrite("test.jpg",frame)
imagetest = image.img_to_array(imagetest)
predict = cnn_model.predict_classes(imagetest)
print(predict)
msg = "";
if str(predict[0]) == '0':
if str(predict[0]) == '1':
if str(predict[0]) == '2':
if str(predict[0]) == '3':
if str(predict[0]) == '4':
45
if str(predict[0]) == '5':
if str(predict[0]) == '6':
if str(predict[0]) == '7':
if str(predict[0]) == '8':
if str(predict[0]) == '9':
cv.imshow('Frame', frame)
break
else:
break
video.release()
cv.destroyAllWindows()
def exit():
global main
main.destroy()
46
font = ('times', 16, 'bold')
title.config(bg='yellow3', fg='white')
title.config(font=font)
title.config(height=3, width=120)
title.place(x=0,y=5)
loadButton.place(x=50,y=200)
loadButton.config(font=font1)
pathlabel = Label(main)
pathlabel.config(bg='DarkOrange1', fg='firebrick4')
pathlabel.config(font=font1)
pathlabel.place(x=50,y=250)
47
uploadButton.place(x=50,y=300)
uploadButton.config(font=font1)
predictButton.place(x=50,y=350)
predictButton.config(font=font1)
exitButton.place(x=50,y=400)
exitButton.config(font=font1)
main.config(bg='MediumPurple1')
main.mainloop()
48
CHAPTER 8
Figure 8.1 illustrates the architecture of a DLCNN used in the context of the real-time
cognitive analysis and prediction of human behaviour in collaborative environments.
It might include graphical representations of different layers within the DLCNN, such
as convolutional layers, pooling layers, and fully connected layers. Each layer's role
and characteristics may be described, providing a visual overview of how data is
processed, and features are extracted within the network.
Figure 8.3 represents a predicted outcome, but in this case, the predicted behaviour is
"Drinking." It might include a visual depiction of the situation where the model
correctly identifies this behaviour, potentially showing relevant frames or features
associated with the prediction.
Figure 8.4 provides a graphical representation of the training progress of the proposed
DLCNN model. It may show two distinct plots: one for accuracy and another for loss.
These plots help monitor the model's performance during training. The accuracy plot
typically shows how well the model is performing on the training data over epochs,
while the loss plot illustrates how the model's error (or loss) is decreasing over time.
By observing these plots, you can assess whether the model is converging to a
satisfactory level of accuracy and low loss or if further training adjustments are
needed.
50
Figure 8.4. Proposed DLCNN accuracy and loss for 10 epochs.
Metric: This column indicates the evaluation metric used to assess the
performance of the methods. In this case, two metrics are used: "Accuracy
(%)" and "Loss."
Existing NBC (Naive Bayes Classifier): This row represents the performance
metrics for an existing method that uses a Naive Bayes Classifier.
Loss: The loss value for this method is 0.8747. The loss is a measure
of how well the model's predictions match the actual values, with
lower values indicating better alignment between predictions and
actual outcomes.
Loss: The loss value for this method is 0.284, which is significantly
lower than the loss of the Naive Bayes Classifier. This suggests that
the Logistic Regression Classifier provides better predictions with a
lower error rate.
Proposed Method: This row presents the performance metrics for a proposed
method, which might be a new or improved approach compared to the existing
methods.
51
Accuracy (%): The proposed method achieves an impressive accuracy
rate of 99.98%, significantly outperforming both the Naive Bayes and
Logistic Regression Classifiers. This indicates that the proposed
method has a very high rate of correct predictions.
Loss: The loss value for the proposed method is 0.03773, which is
remarkably low. This suggests that the proposed method's predictions
are very close to the actual values, with minimal error.
52
CHAPTER 9
9.1 Conclusion
The future scope of real-time cognitive analysis and prediction of human behaviour in
collaborative environments is exceptionally promising, with several exciting avenues
for exploration and development:
54
science, and data ethics. Interdisciplinary collaboration will be essential to
tackle complex behavioural challenges effectively.
55
REFERENCES
[1] L. Lei, J. Hao, A. von Davier, P. Kyllonen, and J-D. Zapata-Rivera. “A tough
nut to crack: Measuring collaborative problem solving.” Handbook of Research
on Technology Tools for Real-World Skill Development. IGI Global, 2016.
344-359. Web. 28 Aug. 2018. doi:10.4018/978-1-4666- 9441-5.ch013
[2] P. Chopade, S. M. Khan, D. Edwards, and A. von Davier, "Machine Learning
for Efficient Assessment and Prediction of Human Performance in
Collaborative Learning Environments," 2018 IEEE International Symposium on
Technologies for Homeland Security (HST), 2018, pp. 1-6, doi:
10.1109/THS.2018.8574203.
[3] Zhang Z, Peng G, Wang W, Chen Y, Jia Y, Liu S. Prediction-Based Human-
Robot Collaboration in Assembly Tasks Using a Learning from Demonstration
Model. Sensors. 2022; 22(11):4279. https://doi.org/10.3390/s22114279.
[4] V. Bianchi, M. Bassoli, G. Lombardo, P. Fornacciari, M. Mordonini and I. De
Munari, "IoT Wearable Sensor and Deep Learning: An Integrated Approach for
Personalized Human Activity Recognition in a Smart Home Environment," in
IEEE Internet of Things Journal, vol. 6, no. 5, pp. 8553-8562, Oct. 2019, doi:
10.1109/JIOT.2019.2920283.
[5] Wan, S., Qi, L., Xu, X. et al. Deep Learning Models for Real-time Human
Activity Recognition with Smartphones. Mobile Netw Appl 25, 743–755
(2020). https://doi.org/10.1007/s11036-019-01445-x
[6] H. F. Nweke, Y. W. Teh, M. A. garadi, U. R. Alo, Deep learning algorithms for
human activity recognition using mobile and wearable sensor networks: State of
the art and research challenges, Expert Systems with Applications, Volume 105,
2018, Pages 233-261, ISSN 0957-4174,
https://doi.org/10.1016/j.eswa.2018.03.056.
[7] M. M. Hassan, Md. Z. Uddin, A. Mohamed, A. Almogren, A robust human
activity recognition system using smartphone sensors and deep learning, Future
Generation Computer Systems, Volume 81, 2018, Pages 307-313, ISSN 0167-
739X, https://doi.org/10.1016/j.future.2017.11.029.
[8] X. Zhou, W. Liang, K. I. -K. Wang, H. Wang, L. T. Yang and Q. Jin, "Deep-
Learning-Enhanced Human Activity Recognition for Internet of Healthcare
Things," in IEEE Internet of Things Journal, vol. 7, no. 7, pp. 6429-6438, July
2020, doi: 10.1109/JIOT.2020.2985082.
56
[9] Z. Chen, L. Zhang, C. Jiang, Z. Cao and W. Cui, "WiFi CSI Based Passive
Human Activity Recognition Using Attention Based BLSTM," in IEEE
Transactions on Mobile Computing, vol. 18, no. 11, pp. 2714-2724, 1 Nov.
2019, doi: 10.1109/TMC.2018.2878233.
[10] C. Xu, D. Chai, J. He, X. Zhang, and S. Duan, "InnoHAR: A Deep Neural
Network for Complex Human Activity Recognition," in IEEE Access, vol. 7,
pp. 9893-9902, 2019, doi: 10.1109/ACCESS.2018.2890675.
[11] Kong, Y., Fu, Y. Human Action Recognition and Prediction: A Survey. Int J
Comput Vis 130, 1366–1401 (2022). https://doi.org/10.1007/s11263-022-
01594-9.
57