Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views41 pages

Lilly Internship

Uploaded by

22981a4248
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views41 pages

Lilly Internship

Uploaded by

22981a4248
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

MACHINE LEARNING

An Internship Report Submited at the end of seventh semester

BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING - AIML

Submitted By

PYDIKONDA LILLY KUMARI


(213J1A4295)

UNDER THE ESTEEMED GUIDANCE OF

SKILL DZIRE
&
Mr. V. GOVINDA RAO (Ph.d)
Assistant Professor
Department of CSM

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING - AIML

RAGHU INSTITUTE OF TECHNOLOGY


(AUTONOMOUS)
Affiliated to JNTU-GV, Vizianagaram
Approved by AICTE, Accredited by NBA, NAAC with ‘A’ grade
2024-2025

1
2
RAGHU INSTITUTE OF TECHNOLOGY
(AUTONOMOUS)
Affiliated to JNTU-GV, Vizianagaram
Approved by AICTE, Accredited by NBA, NAAC with ‘A’ grade

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING - AIML

CERTIFICATE

This is to certify that this project entitled “ Iris flower classification ” done
by “PYDIKONDA LILLY KUMARI (213J1A4295)” is a student of B. Tech in the
Department of computer science and Engineering - AIML, Raghu Institute of
Technology. During the period 2021 - 2025, in partial fulfilment for the award of
the degree of Bachelor of Technology in Computer Science and Engineering -
AIML to Jawaharal Nehru Technological University - Gurjada, Vizianagaram is a
record of bonafide work carried out under my guidance and supervision.

The results embodied n the internship report have not been submitted to
any other University or Institute for the award of any Degree.

INTERNAL GUIDE HEAD OF THE DEPARTMENT

Mr. V. Govinda Rao (Ph.d), Mr. S. Srinadh Raju (Ph.d),


Assistant Professor Associate Professor & HOD

EXTERNAL EXAMINER

3
DISSERTATION APPROVAL SHEET

This is to certify that the dissertation titled

MACHINE LEARNING
BY
PYDIKONDA LILLY KUMARI
(213J1A4295)

Is approved for the degree of Bachelor of Technology

Project Guide Internal Examiner

External Examiner HOD

Date:

4
DECLARATION

This is to certify that this internship titled “MACHINE LEARNING” is bonafied work
done by my me, impartial fulfillment of the requirements for the award of the degree
B.Tech and submitted to the Department of Computer Science and Engineering - AIML ,
Raghu Institute of Technology, Dakamarri.

I also declare that this internship is a result of my own effort and that has not been copied
from anyone and I have taken only citations from the sources which are mentioned in the
references.

This work was not submitted earlier at any other University or Institute for the reward of
any degree.

Date: 21-10-2024

Place: Visakhapatnam

PYDIKONDA LILLY KUMARI


(213J1A4295)

5
ACCEPTANCE LETTER

6
CERTIFICATE

7
ACKNOWLEDGMENT

I express sincere gratitude to my esteemed Institute “Raghu Institute of Technology”,


which has provided us an opportunity to fulfill the most cherished desire to reach my
goal.
I take this opportunity with great pleasure to put on record our ineffable personal
indebtedness to Mr. Raghu Kalidindi, Chairman of Raghu Institute of Technology for
providing necessary departmental facilities.
I would like to thank the Principal Dr. S. Satyanarayana of “Raghu Institute of
Technology”, for providing the requisite facilities to carry out projects on campus. Your
expertise in the subject matter and dedication towards our project have been a source of
inspiration for all of us.
I sincerely express our deep sense of gratitude to S. Srinadh Raju, Associate
Professor & Head of Department in Department of Computer Science and Engineering -
AIML & DS, Raghu Institute of Technology, for her perspicacity, wisdom and sagacity
coupled with compassion and patience. It is my great pleasure to submit this work under
her wing. I thank for guiding us for the successful completion of this project work.
I extend my deep hearted thanks to all faculty members of the Computer Science -
AIML department for their value based imparting of theory and practical subjects, which
were used in the project.
I thank the non-teaching staff of the Department of Computer Science - AIML and
Engineering, Raghu Institute of Technology, for their inexpressible support.

PYDIKONDA LILLY KUMARI


(213J1A4295)

8
INTRODUCTION

Machine learning (ML) is a subfield of artificial intelligence (AI) that focuses on the
creation of systems capable of learning from data and making decisions without explicit
programming for every task. Instead of following predetermined instructions, machine
learning models analyze data, recognize patterns, and adjust their behavior to improve
performance over time. This ability to adapt and generalize makes machine learning
especially useful in handling complex problems that are difficult to code manually.

There are three main types of machine learning: supervised learning, unsupervised
learning, and reinforcement learning. In supervised learning, the model is trained on
labeled data, meaning it learns from input-output pairs to make predictions about new,
unseen data. Unsupervised learning, on the other hand, deals with unlabeled data, and
the model tries to discover hidden patterns or structures in the data without explicit
guidance. Reinforcement learning involves training a model to make a sequence of
decisions by rewarding it for successful actions and penalizing it for poor ones, often used
in applications like game-playing or robotic control.

The core concept behind machine learning is the use of algorithms that can sift through
vast amounts of data to identify patterns and relationships. These algorithms can vary in
complexity, from simple linear regression models to more advanced neural networks used
in deep learning. The choice of algorithm depends on the specific problem being
addressed, the amount and quality of the data, and the required accuracy. As data is
processed through the algorithm, the model adjusts its parameters to minimize errors,
thus improving its predictive capabilities.

Machine learning has become integral to many modern technologies, such as


recommendation systems, natural language processing, and autonomous vehicles. Its
applications are vast, spanning industries like healthcare, finance, retail, and
entertainment. As more data becomes available and computing power increases, machine
learning is expected to continue revolutionizing various fields, making systems smarter
and more efficient.

9
TABLE OF CONTENTS

S.NO CONTENT PAGE NUMBER

1. MODULE 1: INTRODUCTION TO PYTHON 11-12

2. MODULE 2: OOPS IN PYTHON 13-14

3. MODULE 3: PANDAS, NUMPY LIBRARIES 15-16

MODULE 4: INTRODUCTION TO MACHINE


4. 17-18
LEARNING

MODULE 4: APPLICATIONS OF MACHINE


5. 19-20
LEARNING

MODULE 6: SUPERVISED & UNSUPERVISED


6. 21-24
LEARNING

7. MODULE 7: COMPUTER VISION AND CNN 25-28

8. MODULE 8: YOLO, YOLOV3 ALGORITHM 29-31

MODULE 9: NATURAL LANGUAGE


9. 32-34
PROCESSING

10. ANNEXURE 35-41

10
MODULE 1: INTRODUCTION TO PYTHON

OBJECTIVES:
1. Introduction to python
2. Data types in python
3. Applications of Python
4. Conditional Statements
5. Functions in Python
1. Lambda Function
2. Kwargs Function

Introduction to Python:

Python is a high-level, interpreted programming language known for its simplicity


and readability. It is widely used for various applications, from web development to data
analysis, due to its extensive libraries and supportive community. Python supports
multiple programming paradigms, including procedural, object-oriented, and functional
programming.

Data Types in Python:


Python supports several built-in data types, including:
int: Integer values
float: Floating-point numbers
str: Strings for text
list: Ordered and mutable collection of items
tuple: Ordered but immutable collection
dict: Key-value pairs
set: Unordered collection of unique items

Applications of Python :
Web development (using frameworks like Django and Flask)
Data Science and Machine Learning (with libraries like NumPy, Pandas,
TensorFlow)
Automation and scripting
Game development (using Pygame)
Artificial Intelligence and deep learning

11
Conditional Statements:

Conditional statements in Python control the flow of execution based on conditions.


Commonly used statements include:
if: Executes a block if a condition is true.
else: Executes a block if the preceding condition is false.
elif: Checks another condition if the previous conditions are false.

Functions in Python:

Functions are blocks of reusable code that can be executed when called. Functions can
accept parameters and return results.

1. Lambda Function:
A lambda function is a small anonymous function defined using the `lambda` keyword.
It can have any number of arguments but only one expression.

Code:
example = lambda x, y: x + y

2. Kwargs Function:
The `kwargs` parameter allows a function to accept an arbitrary number of keyword
arguments. Inside the function, `kwargs` is stored as a dictionary.

Code:
def example(**kwargs):
for key, value in kwargs.items():
print(f"{key} = {value}")

12
MODULE 2: OOPS IN PYTHON

OBJECTIVES:
OOP’s concept in python
1. Encapsulation
2. Abstraction
3. Inheritance
4. Polymorphism

OOP’s Concept in Python:

Object-Oriented Programming (OOP) in Python is a paradigm centered around the


concept of objects, which are instances of classes. OOP allows developers to structure
programs using concepts like encapsulation, inheritance, and polymorphism, making
code more modular, reusable, and maintainable.

1. Encapsulation
Encapsulation is the concept of bundling data (attributes) and methods (functions)
within a class and restricting direct access to them. It ensures that data is protected and
can only be accessed through methods, maintaining control over modifications.
Code:
class Example:
def __init__(self, value):
self.__value = value # Private attribute
def get_value(self):
return self.__value

2. Abstraction
Abstraction involves hiding the complex implementation details and exposing only the
essential features of an object. This allows users to interact with objects at a high level,
without needing to understand the internal workings.

13
Code:
from abc import ABC, abstractmethod
class Shape(ABC):
@abstractmethod
def area(self):
pass

3. Inheritance
Inheritance allows one class (child class) to inherit the attributes and methods of another
class (parent class). This promotes code reuse and establishes relationships between
classes.
Code:
class Animal:
def sound(self):
print("Animal makes a sound")

class Dog(Animal):
def sound(self):
print("Dog barks")

4. Polymorphism
Polymorphism refers to the ability of different classes to provide different
implementations for the same method. It allows objects of different types to be treated as
objects of a common base type.
Code:
class Cat:
def sound(self):
print("Cat meows")

class Dog:
def sound(self):
print("Dog barks")

def make_sound(animal):
animal.sound()

14
MODULE 3: PANDAS, NUMPY LIBRARIES

OBJECTIVES:
Introduction to Numpy
Introduction to Pandas
Applications of these Libraries

Numpy:
NumPy (Numerical Python) is a fundamental library in Python for numerical
computing. It provides support for large, multi-dimensional arrays and matrices, along
with a collection of mathematical functions to operate on these arrays. NumPy is highly
efficient for numerical computations due to its underlying implementation in C, allowing
for faster execution than traditional Python lists.
NumPy Applications:
Scientific computing: Performing complex mathematical operations on large
datasets, such as linear algebra, Fourier transformations, and statistical
operations.
Data analysis: Efficient manipulation and storage of large arrays and datasets.
Machine learning: Used as a backbone for libraries like TensorFlow and scikit-
learn for data preprocessing and numerical calculations.
NumPy in Machine Learning:
NumPy is crucial in machine learning for handling large datasets and performing
mathematical computations efficiently. It is used for creating arrays that store data and
for implementing key machine learning algorithms like gradient descent, linear
regression, and neural networks
Example Code:
import numpy as np
X = np.array([1, 2, 3, 4, 5])
Y = np.array([1, 3, 2, 3, 5])
m = (np.mean(X) * np.mean(Y) - np.mean(X * Y)) / (np.mean(X)**2 -
np.mean(X**2))
b = np.mean(Y) - m * np.mean(X)
prediction = m * 6 + b
print(f"Predicted score for 6 hours of study: {prediction}")

15
Pandas:
Abstraction involves hiding the complex implementation details and exposing only
the essential features of an object. This allows users to interact with objects at a high
level, without needing to understand the internal workings.

Pandas Applications:
Data wrangling: Cleaning, transforming, and preparing data for analysis,
especially useful for handling tabular data from sources like CSV, Excel, and
databases.
Time series analysis: Pandas is widely used for handling and analyzing time-
stamped data.
Exploratory data analysis (EDA): Allows easy visualization, grouping, and
summarization of data for insights in data science and analytics.

Pandas in Machine Learning:


Pandas is widely used for data preprocessing and manipulation in machine learning.
It allows users to clean, transform, and analyze structured datasets, which is crucial for
building machine learning models. Pandas simplifies tasks like handling missing data,
normalizing data, and converting categorical data into numerical form.
Example Code:
import pandas as pd
# Load a sample dataset
data = {'Name': ['John', 'Alice', 'Bob', 'Emma'],
'Age': [25, 30, 22, 35],
'Salary': [50000, 60000, 52000, 70000]}
df = pd.DataFrame(data)
# Basic data preprocessing
df['Age'] = df['Age'].fillna(df['Age'].mean()) # Filling missing values
df['Salary'] = df['Salary'] / 1000 # Normalizing salary values
print(df)

16
MODULE 4: INTRODUCTION TO MACHINE LEARNING

OBJECTIVES:
Introduction to Machine learning
Evolution of Machine Learning
Why Python? Libraries and Frameworks for ML

Introduction to Machine Learning:


Machine Learning (ML) is a branch of artificial intelligence that enables computers to
learn from data and improve their performance without being explicitly programmed. It
involves developing algorithms that can detect patterns in data and make decisions or
predictions based on that data. Machine learning is widely used in various fields such as
healthcare, finance, marketing, and robotics, driving innovations like autonomous
vehicles, recommendation systems, and natural language processing.

Evolution of Machine Learning:


1950s–1980s: The early days of AI research led to rule-based systems, expert systems,
and simple learning models like the perceptron.
1990s: With more computational power, algorithms like decision trees, support vector
machines (SVM), and neural networks gained traction. The rise of the internet also
provided more data for model training.
2000s: Machine learning saw rapid growth due to advances in computational power,
the availability of large datasets, and more sophisticated algorithms like ensemble
learning and deep learning.
2010s–Present: Deep learning and neural networks, driven by GPUs and big data,
revolutionized ML applications like computer vision, speech recognition, and AI-
powered assistants. The rise of cloud computing and the democratization of AI has
further accelerated ML adoption across industries.

17
Why Python for Machine Learning?
Ease of use: Python’s simplicity and readability make it accessible to beginners,
while its powerful features make it suitable for complex applications.
Extensive libraries and frameworks: Python has a rich ecosystem of libraries
and frameworks specifically designed for machine learning, making it easy to
develop and deploy ML models.
Community support: Python has a large and active community of developers
and data scientists, which means continuous improvements, support, and a
wealth of open-source resources.
Integration capabilities: Python can easily integrate with other languages,
frameworks, and tools, allowing for flexible and scalable machine learning
workflows.

Libraries and Frameworks for ML in Python


NumPy: Supports numerical operations and array-based computations.
Pandas: Simplifies data manipulation and preprocessing.
Scikit-learn: Provides simple and efficient tools for data mining and analysis,
including various algorithms like regression, classification, and clustering.
TensorFlow: An open-source library developed by Google for building and
training deep learning models.
Keras: A high-level neural networks API, running on top of TensorFlow,
designed for fast experimentation with deep learning models.
PyTorch: Developed by Facebook, PyTorch is widely used for deep learning
research and production applications, offering dynamic computational graphs.

Tools for ML Development


Jupyter Notebook: An interactive environment for running code, visualizing
data, and documenting results in real-time.
Google Colab: A cloud-based version of Jupyter that provides free access to
GPUs for training machine learning models.
Anaconda: A distribution platform that simplifies package management and
deployment of Python and machine learning environments.
MLflow: A tool for managing the ML lifecycle, including experimentation,
reproducibility, and deployment.

18
MODULE 5: APPLICATIONS OF MACHINE LEARNING

OBJECTIVES:
Machine learning Responsibilities
Application of Machine Learning
Process of Machine Learning
Popular Algorithms in ML

Machine Learning Responsibilities:


1. Data collection and preprocessing: Gathering raw data and transforming it into a
usable format.
2. Model selection and training: Choosing an appropriate algorithm and training it
using the data.
3. Model evaluation and optimization: Assessing model performance and tuning it
for better accuracy.
4. Deployment and maintenance: Implementing the model in a production
environment and monitoring its performance.

Applications of Machine Learning:


1. Image recognition: Used in facial recognition, object detection, and medical
imaging.
2. Natural language processing (NLP): Applied in chatbots, translation services,
and sentiment analysis.
3. Fraud detection: Identifying unusual patterns in transactions to detect fraud.
4. Recommendation system: Suggesting products, movies, or content based on user
preferences.

Popular Algorithms in Machine Learning:


1. Linear Regression: Used for predicting numerical values.
2. Decision Trees: Models decisions and their possible consequences.
3. Support Vector Machines (SVM): Used for classification tasks.
4. Neural Networks: Mimics the human brain to solve complex problems.
5. K-Nearest Neighbors (KNN): Classifies data based on the nearest data points.

19
Process of Machine Learning:
1. Problem definition: Understanding the business problem or task.
2. Data collection: Gathering relevant data for analysis.
3. Data preprocessing: Cleaning and transforming data into a suitable format.
4. Model training: Feeding data into algorithms to learn patterns.
5. Model evaluation: Testing the model's performance on unseen data.
6. Prediction: predicting the output
6. Deployment: Integrating the model into the system for real-world use.

20
MODULE 6: SUPERVISED & UNSUPERVISED LEARNING

OBJECTIVES:
Introduction to types of ML
Linear Regression
Decision Tree
Neural Networks
Clustering

Introduction to Types of Machine Learning:


Machine Learning (ML) can be categorized into three main types based on how they
learn from data

1.Supervised Learning:
In supervised learning, the model is trained on a labeled dataset, which
means that each training example is paired with the correct output. The goal is for
the model to learn the relationship between the input data (features) and the
output data (label), so it can predict the output when given new input data. This
approach is commonly used for tasks such as classification (e.g., email spam
detection) and regression (e.g., predicting house prices).
Example: Predicting whether an email is spam or not based on its content.
2.Unsupervised Learning:
Unsupervised learning involves training a model on data that does not
have labeled outcomes. Instead of predicting outcomes, the goal is to find hidden
patterns or intrinsic structures in the input data. This type of learning is useful in
scenarios where we don’t have labeled data but want to explore the data for
insights.
Example: Clustering customers based on purchasing behavior to create
different customer segments
3.Reinforcement Learning:
In reinforcement learning, an agent interacts with an environment and
learns to make decisions by receiving rewards or penalties for its actions. The agent
aims to learn the best possible actions to take in various situations to maximize the
cumulative reward over time. It is commonly used in robotics, game playing, and
autonomous systems.
Example: Training an AI to play a game like Chess or Go, where it
improves by receiving feedback after each move (win or lose).

21
Linear Regression:
Linear regression is a supervised learning algorithm used primarily for regression tasks,
where the goal is to predict a continuous output variable based on one or more input
variables (features). It assumes that there is a linear relationship between the independent
variables (inputs) and the dependent variable (output).
Simple Linear Regression: This involves one independent variable and one dependent
variable, where the relationship is represented as a straight line (y = mx + b). The
algorithm tries to find the best-fitting line through the data points by minimizing the
difference between the actual and predicted values.
Multiple Linear Regression: In this case, there are multiple independent variables, and
the algorithm attempts to model the relationship between the dependent variable and
multiple input features. The output is a weighted sum of the input variables.
Applications:
Predicting house prices based on features like area, number of rooms, etc.
Forecasting sales or revenue based on advertising expenditure.
Estimating the effect of temperature on electricity consumption.
Key Concepts:
Coefficient: Represents the strength of the relationship between the input variable and
the output.
Intercept: The point where the line intersects the y-axis, representing the output when
all inputs are zero.
Residuals: The difference between actual values and predicted values.

Decision Tree:
A decision tree is a non-parametric, supervised learning algorithm used for both
classification and regression tasks. It models decisions in the form of a tree structure,
where each internal node represents a test on an attribute (a decision based on a feature),
each branch represents the outcome of the test, and each leaf node represents a class label
or a value (in regression).
How It Works:
The algorithm recursively splits the dataset into smaller subsets based on the most
significant feature at each step, creating a tree structure. Each split aims to reduce the
uncertainty or impurity in the data. For classification, this means minimizing the mix of
classes in the subgroups; for regression, it aims to minimize the difference between
predicted and actual values.

22
Key Elements:
Root Node: The initial node where the first decision is made.
Internal Nodes: Intermediate nodes where further decisions are made based on
feature values.
Leaf Nodes: Final nodes that represent the predicted class or value.
Applications:
Credit scoring to decide whether to approve a loan.
Predicting customer churn based on user activity.
Medical diagnosis to classify patients based on symptoms.

Neural Networks:
Neural networks are a set of algorithms modeled loosely after the human brain,
designed to recognize patterns in data. They consist of interconnected layers of nodes
(neurons), where each connection represents a weight, and each neuron applies an
activation function to the input it receives. Neural networks are particularly effective in
handling complex tasks like image recognition, speech processing, and predictive
analytics.
Structure:
Input Layer: The first layer that receives the input data.
Hidden Layers: Intermediate layers that process the input data by performing
weighted sums and applying activation functions. These layers enable the
network to capture complex patterns and relationships in the data.
Output Layer: The final layer that provides the prediction (e.g., classification or
regression output).
Training:
Neural networks learn through a process called backpropagation, where the error
between the predicted output and the actual output is propagated back through the
network. The weights of the connections are adjusted to minimize this error over time.
The training is performed over multiple iterations (epochs) using an optimization
technique called gradient descent.
Activation Functions:
Sigmoid: Used for binary classification tasks, maps input to a value between 0
and 1.
ReLU (Rectified Linear Unit): Used for hidden layers, improves the convergence
of the model.
Softmax: Used for multi-class classification.

23
Applications:
Image classification (e.g., recognizing objects in images).
Natural language processing (e.g., sentiment analysis, translation).
Recommendation systems (e.g., suggesting products or movies).

Clustering:
Clustering is an unsupervised learning technique used to group similar data points
together based on their features. It helps in discovering the natural structure in the data
without the need for labeled outcomes.
How It Works:
The algorithm analyzes the data and divides it into groups or clusters where data
points within the same group are more similar to each other than to those in other
clusters. Clustering is useful for finding hidden patterns or segments in the data.
Popular Clustering Algorithms:
K-Means: Divides the data into K clusters by minimizing the distance between
data points and the centroid of the clusters.
Hierarchical Clustering: Builds a hierarchy of clusters, either by merging smaller
clusters into larger ones (agglomerative) or by splitting larger clusters into smaller
ones (divisive).
DBSCAN (Density-Based Spatial Clustering of Applications with Noise): Groups
data points based on the density of points in a region, useful for finding clusters
of arbitrary shapes and for detecting outliers.
Applications:
Customer segmentation: Grouping customers based on purchasing behavior to
create targeted marketing strategies.
Image segmentation: Dividing an image into meaningful regions for further
analysis.
Anomaly detection: Identifying unusual patterns in data that may indicate fraud
or errors.

24
MODULE 7: COMPUTER VISION AND CNN

OBJECTIVES:
Computer Vision
CNN
Process of CNN
Applications of Computer Vision and CNN

Computer Vision :
Computer Vision (CV) is a field of artificial intelligence that enables machines to
interpret and understand visual data from the world, such as images and videos. It
mimics human vision by allowing computers to analyze and make decisions based on
visual inputs. Common tasks include object detection, facial recognition, image
segmentation, and scene reconstruction.

- OpenCV (Open Source Computer Vision Library):


OpenCV is a popular open-source computer vision and machine learning software
library that provides a wide range of tools and functions for image processing, video
capture, object tracking, and more. It supports multiple programming languages (like
Python, C++, and Java) and is widely used for real-time applications in fields such as
robotics, augmented reality, and autonomous driving.

- Key Functions in OpenCV:


- Image Processing: Operations like filtering, edge detection, and color transformations.
- Object Detection: Identifying objects in images or videos.
- Face Recognition: Recognizing and verifying faces in real-time.
- Feature Extraction: Detecting and matching key features in images (e.g., SIFT,
SURF).

Convolutional Neural Networks (CNN):


Convolutional Neural Networks (CNNs) are a class of deep learning neural
networks designed specifically for processing and analyzing visual data. CNNs have
revolutionized computer vision by achieving state-of-the-art performance in tasks like
image classification, object detection, and facial recognition. CNNs are highly effective in
identifying spatial features and patterns (such as edges, textures, and shapes) from
images.

25
-Key Layers of CNN:
- Convolutional Layer: The core building block of a CNN, this layer applies a
convolution operation to the input image using a set of filters (kernels) to extract feature
maps. The goal is to detect local patterns such as edges, corners, and textures.
- Pooling Layer: Reduces the dimensionality of the feature maps while retaining
important information. The most common pooling operation is max pooling, which
selects the maximum value from a small region of the feature map.
- Fully Connected Layer (Dense Layer): After multiple convolutional and pooling layers,
the output is flattened and passed through fully connected layers to generate the final
classification scores or predictions.
- Activation Functions: Commonly used functions include ReLU (Rectified Linear Unit)
to introduce non-linearity and Softmax to provide probabilities for classification.

Process of CNN:
1. Input Layer:
The input is usually a raw image, represented as pixel values in the form of a matrix (e.g.,
a 2D matrix for grayscale images or a 3D matrix for RGB images).
2. Convolutional Layer:
The CNN applies several convolution filters (kernels) to the input image to detect
various features, such as edges, textures, and patterns. This operation results in feature
maps, which highlight the detected patterns in the image.
3. Activation Layer:
After each convolution operation, an activation function (e.g., ReLU) is applied to
introduce non-linearity to the network, enabling it to learn more complex patterns.
4. Pooling Layer:
A pooling operation (e.g., max pooling) reduces the size of the feature maps, which
decreases the computational load and helps prevent overfitting. Pooling retains the most
important information while reducing the dimensionality.
5. Flattening:
The feature maps from the final convolutional or pooling layer are flattened into a 1D
vector, which can be fed into the fully connected layers.
6. Fully Connected Layer:
The flattened vector is passed through one or more fully connected layers, where the
final classification or regression is made. For classification tasks, the Softmax function is
typically used to generate probabilities for different classes.

26
7. Output Layer:
The output layer provides the final prediction (e.g., a class label in classification tasks or
a numerical value in regression tasks).
8. Backpropagation and Optimization:
During training, the error between the predicted and actual labels is calculated, and the
weights of the network are adjusted through backpropagation and gradient descent to
minimize the error.

Applications of Computer Vision and CNN:

1. Image Classification:
CNNs can classify images into predefined categories. This is used in applications like
facial recognition, medical image analysis, and animal species identification.
- Example: Detecting cats or dogs in an image.
2. Object Detection and Recognition:
Computer vision, enhanced by CNNs, can detect and recognize objects in images or
videos. This is critical in fields like autonomous vehicles, security systems, and retail
automation.
- Example: Detecting pedestrians or other vehicles in real-time for autonomous driving.
3. Image Segmentation:
Segmentation refers to partitioning an image into meaningful parts (e.g., identifying
different objects within an image). CNNs are used in semantic segmentation tasks where
each pixel is classified as belonging to a specific object class.
- Example: Separating foreground objects from the background in a medical scan
(tumor detection).
4. Facial Recognition:
CNNs are highly effective in detecting and recognizing faces in images and videos. This
technology is widely used in security systems, authentication processes, and social media
applications.
- Example: Unlocking smartphones using face ID
5. Medical Imaging:
CNNs are used in analyzing medical images (like X-rays, MRIs, and CT scans) to
detect abnormalities, diagnose diseases, and assist in treatment planning.
- Example: Detecting tumors or anomalies in brain scans.

27
6. Self-Driving Cars:
Computer vision powered by CNNs is used in autonomous vehicles to detect and
identify obstacles, road signs, and lane markings, enabling safe navigation.
- Example: Real-time object detection for autonomous driving, including pedestrians,
vehicles, and traffic signals.
7. Augmented Reality (AR):
Computer vision allows AR systems to understand the real-world environment and
overlay virtual objects onto it. CNNs help in detecting and tracking objects to enable
immersive experiences.
- Example: Inserting virtual objects into live camera feeds in mobile applications (e.g.,
Pokémon GO).
8. Anomaly Detection:
In industrial applications, CNNs are used to detect defects or anomalies in products by
analyzing images from production lines.
- Example: Quality control in manufacturing, where defective items are identified based
on visual analysis.
9. Gesture Recognition:
CNNs can analyze video inputs to recognize and interpret human gestures, which is
useful in human-computer interaction, gaming, and virtual reality.
- Example: Controlling devices or games with hand gestures (e.g., waving to control a
game character).

Fig 2: Demonstration of Working of CNN

28
MODULE 8: YOLO, YOLOV3 ALGORITHM

OBJECTIVES:

YOLO
YOLO V3

YOLO (You Only Look Once) is a state-of-the-art, real-time object detection algorithm
that is known for its speed and efficiency. Unlike other object detection methods that
look at different regions of an image and process them separately (e.g., R-CNN), YOLO
looks at the entire image in one go, which makes it faster than many alternatives. YOLO
formulates object detection as a single regression problem, predicting bounding boxes
and class probabilities directly from the input image in one forward pass through the
network.

How YOLO Works:


1.Input Image Splitting:
YOLO divides the input image into an S×SS \times SS×S grid. Each grid cell is
responsible for detecting objects whose center falls within the cell.
2. Bounding Box Prediction:
Each grid cell predicts a fixed number (usually 2) of bounding boxes. For each
bounding box, the algorithm predicts:
The center coordinates (x,y)(x, y)(x,y) of the box (relative to the grid cell).
The width and height of the box (relative to the entire image).
A confidence score, which reflects the probability that the box contains an object
and the accuracy of the predicted bounding box.
3. Class Probability Prediction:
Along with the bounding box predictions, each grid cell predicts class probabilities for
the detected object. This allows YOLO to classify what type of object is present in the
bounding box (e.g., car, dog, person).
4. Final Prediction:
The final prediction includes the bounding boxes, confidence scores, and class
labels. These are refined using a post-processing technique called Non-Maximum
Suppression (NMS) to remove overlapping boxes and keep only the one with the highest
confidence score.

29
YOLOv3 Algorithm:
YOLOv3 is the third version of the YOLO algorithm, which brings several
improvements over its predecessors (YOLO and YOLOv2). YOLOv3 maintains the core
principle of detecting objects by looking at the entire image in one pass but introduces
enhancements in accuracy and efficiency, making it more suitable for complex object
detection tasks.
Key Improvements in YOLOv3:
1. Multi-Scale Predictions:
One of the major improvements in YOLOv3 is its ability to make predictions at three
different scales. This allows the network to detect objects of various sizes more effectively.
Each scale corresponds to a different stage of the network, where feature maps are
smaller but more abstract (lower resolution for larger objects and higher resolution for
smaller objects).
2. Darknet-53 Backbone:
YOLOv3 uses Darknet-53 as its backbone network for feature extraction. Darknet-53
is a convolutional neural network with 53 layers, which is deeper and more efficient than
the previous version (Darknet-19 used in YOLOv2). It employs residual connections,
similar to ResNet, which improves the training process and accuracy.
3. Bounding Box Prediction:
YOLOv3 predicts bounding boxes using anchor boxes, similar to methods like
Faster R-CNN and SSD. Anchors are predefined shapes that help the model predict
boxes with various aspect ratios more effectively. YOLOv3 predicts four coordinates for
each bounding box: xxx, yyy, width, and height, relative to the anchor boxes.
4. Class Prediction with Multi-Label Classification:
Instead of using Softmax for class predictions (which limits the detection to one
class per bounding box), YOLOv3 uses independent logistic classifiers for each class. This
allows multi-label classification, meaning a bounding box can be assigned to multiple
classes simultaneously, which is useful in scenarios where an object might belong to more
than one category.
1.Better Detection of Small Objects:
2.YOLOv3 improves the detection of small objects by making predictions at different
layers of the network. The lower layers of the network, which preserve higher-
resolution feature maps, are used for detecting smaller objects, while deeper layers are
used for detecting larger objects.

30
YOLOv3 Process:
Image Input:
The input image is resized to a fixed size (e.g., 416x416 pixels) and fed into the
Darknet-53 backbone, which extracts feature maps at three different scales (small,
medium, and large).
Feature Extraction:
The feature maps from Darknet-53 are used to predict bounding boxes at three
different scales, allowing YOLOv3 to detect objects of various sizes in a single image.
Bounding Box Prediction:
For each grid cell in the feature maps, YOLOv3 predicts a set of bounding boxes
with associated confidence scores and class probabilities. Each bounding box prediction
includes:
Coordinates (x,y)(x, y)(x,y) for the center of the box.
Width and height of the box.
Confidence score (how likely it is that an object is inside the box).
Class probabilities (which class the object belongs to).
Anchor Boxes:
YOLOv3 uses anchor boxes to handle objects with varying aspect ratios. It predicts
offsets relative to these anchors to fine-tune the bounding boxes.
Non-Maximum Suppression (NMS):
To refine the results, YOLOv3 applies Non-Maximum Suppression, which removes
overlapping boxes by keeping the ones with the highest confidence scores for each
detected object.

31
MODULE 9: NATURAL LANGUAGE PROCESSING

OBJECTIVES:
Introduction to NLP
Subsets of NLP
Algorithm of NLP
Working of NLP

Introduction to Natural Language Processing (NLP):


Natural Language Processing (NLP) is a field of artificial intelligence that focuses on
enabling machines to understand, interpret, and respond to human language in a
meaningful way. NLP sits at the intersection of linguistics and computer science, helping
computers process and analyze large amounts of natural language data (text or speech).
The goal is to bridge the communication gap between humans and machines, enabling
computers to understand not just structured data but also the complexities of human
languages like English, Spanish, Chinese, and more.
NLP is crucial for many applications, including language translation, speech
recognition, chatbots, sentiment analysis, and more.
Subsets of NLP:
NLP is composed of various subfields, each focusing on specific tasks related to
language understanding, generation, and analysis.
1. Syntax:
The study of how words are arranged in a sentence. In NLP, syntactic analysis
(parsing) involves analyzing the structure of a sentence and ensuring that it adheres to the
grammatical rules of a language.
Applications: Grammar checking, sentence structure analysis.
2. Semantics:
Concerned with the meaning of words, phrases, and sentences. Semantic analysis aims
to understand the meaning conveyed by a sentence.
Applications: Word sense disambiguation, machine translation, information
retrieval.
3. Morphology:
The study of word formation and the structure of words. Morphological analysis
breaks words into their base forms (root words or stems) and inflections (suffixes or
prefixes).
Applications: Lemmatization, stemming.

32
4. Pragmatics:
Focuses on understanding how context influences the interpretation of meaning. It
deals with how the situation, tone, and context of conversation can change the intended
meaning of words.
Applications: Contextual language understanding in virtual assistants (e.g., Siri,
Alexa).
5. Phonology:
The study of sound patterns in spoken language. In NLP, this involves speech
recognition and processing.
Applications: Speech-to-text systems, voice recognition.
6. Discourse:
Analyzes how multiple sentences or phrases relate to each other in a conversation
or text. It aims to understand the flow of information across a longer text.
Applications: Text summarization, dialogue systems, conversation agents.
7. Named Entity Recognition (NER):
Identifying and classifying entities in a text (e.g., people, places, organizations) into
predefined categories.
Applications: Information extraction, content categorization.
8. Sentiment Analysis:
Identifying and categorizing opinions or emotions expressed in a text. It helps
determine whether the sentiment behind a piece of content is positive, negative, or
neutral.
Applications: Social media monitoring, customer feedback analysis.

Fig 3: Subset structure of NLP

33
Algorithms of NLP (Shortened):
1. Bag of Words (BoW): Represents text as word counts or binary presence,
ignoring word order.
Used in: Text classification, spam filtering.
2. TF-IDF: Evaluates the importance of words relative to their frequency in a
document and across documents.
Used in: Information retrieval, document classification.
3. Word Embeddings (Word2Vec, GloVe): Maps words to vectors that capture
semantic relationships.
Used in: Sentiment analysis, text similarity.
4. RNNs/LSTMs: Deep learning models that process sequential data,
maintaining context across words.
Used in: Language modeling, machine translation.
5. Transformer Models (BERT, GPT): Use attention mechanisms to process input
in parallel, improving context understanding.
Used in: Text classification, question answering.
6. Naive Bayes: A probabilistic classifier based on Bayes' theorem.
Used in: Spam detection, document classification.
7. Hidden Markov Models (HMMs): Models sequences of words or sounds for
tasks like speech recognition.
Used in: Speech recognition, part-of-speech tagging.

Working of NLP (Shortened):


1. TextPreprocessing: Tokenization, stopword removal, stemming/lemmatization,
lowercasing, and punctuation removal.
2. Feature Extraction: Represent text using BoW, TF-IDF, or word embeddings.
3. Text Representation: Convert text into numerical data (vectors).
4. Modeling: Apply machine learning (e.g., Naive Bayes) or deep learning models
(e.g., RNNs, Transformers) to analyze the text.
5. Prediction: Models output results like sentiment, categories, or translations.
6. Post-Processing: Adjust the output for fluency, grammar, or entity extraction.
7. Evaluation: Measure performance using metrics like accuracy or F1-score.

34
ANNEXURE
Title: Iris flower classification
Add a problem statement:
Develop a machine learning model that accurately classifies Iris flowers into their
respective species (Iris setosa, Iris virginica or Iris versicolor) using the following features:
- Sepal length (cm)
- Sepal width (cm)
- Petal length (cm)
- Petal width (cm)

Objectives:
1. Model Development: Design and train a robust classification model.
2. Performance Evaluation: Assess model performance using accuracy, precision, recall,
F1-score and confusion matrix.
3. Feature Importance: Identify key morphological characteristics influencing
classification.
4. Model Comparison: Evaluate and compare performance across different machine
learning algorithms.
Abstract:
In Machine Learning, we are using semi-automated extraction of knowledge of data for
identifying IRIS flower species. Classification is a supervised learning in which the response is
categorical that is its values are in finite unordered set. To simply the problem of
classification, scikit learn tools has been used. This paper focuses on IRIS flower
classification using Machine Learning with scikit tools. Here the problem concerns the
identification of IRIS flower species on the basis of flowers attribute measurements.
Classification of IRIS data set would be discovering patterns from examining petal and sepal
size of the IRIS flower and how the prediction was made from analyzing the pattern to from
the class of IRIS flower. In this paper we train the machine learning model with data and
when unseen data is discovered the predictive model predicts the species using what it has
been learnt from the trained data

keywords:
classification
Logistic Regression
k-nearest neighbour
Machine learning

35
Context

1.Importing libraries

2.Importing data set

36
Fig : shows the visualization of x and y axis of median_house_value

37
3.x-axis data

Data on x-axis

4.y-axis data

Data on y-axis

38
5.precision,recall,f1-score, support

6.Iris data

39
40
7.conclusion:
The primary goal of supervised learning is to build a model that
“generalizes”. Here in this project we make that “generalizes”. Here in
this project we make predictions on unseen data which is the data not
used to train the model hence the machine learning model built should
accurately predicts the species of future flowers rather than accurate
predicting the label of already trained data.
The iris flower classification problem demonstrates the effectiveness of
machine learning algorithms in accurately predicting the species of iris
flowers based on their morphological characteristics.
1. Machine learning algorithms can effectively classify iris flowers into
their respective species.
2. Morphological characteristics (petal length, width, sepal length and
width) are sufficient for accurate classification.
3. Model selection, hyperparameter tuning and feature engineering
significantly impact performance.
4. Automated classification supports applications in botany, ecology and
conservation.t

8.Real world Applications:

1. Automated species identification.


2. Ecology and conservation
research.
3. Horticulture and agriculture.
4. Image classification and
computer vision.t

41

You might also like