Day-4: ML and Image processing
Lets Review and Advance,
ML
From an example,
Computer perspective:
Data Analysis, can be done from the data set with Valid/known data as per requirement of Analysis.
With these data, computer can do Analysis like, finding Avg, count, sum.
But, computer can't predict/Guess the future Data.
Computer is good at Calculations not on prediction.
From above Dataset:
* If we want to find marks of King who studied 7 hrs duration, Computer Can't predict it.
* If we want to find Duration of Queen who got 90 marks, Computer Can't predict it.
Human Perspective:
Human can do data analysis with this Known data.
Also, Human has the ability to Predict/Guess the Future data o/p with Unknown/Valid data.
From above Dataset:
* If we want to find marks of King who studied 7 hrs duration, Human Can predict it.
* If we want to find Duration of Queen who got 90 marks, Human Can predict it.
Summary:
- Human has this God Gift(Technically Intelligence) to predict the Future data. It is
called " Human Intelligence ".
- For machines, to have this intelligence we have to train the machine, this is Called
" Machine Learning ".
Let's dive into M.L:
To make the Machine Intelligent, we have to make the machine to train same as Human though process. As below shown,
Pre-Requisites, Basics of each Stage:
Data Set:
for an Requirement, we should know about X and Y variables from Dataset.
We should know the relation between X and Y and this relation is called " Correlation ".
Machine:
In Machine, we should define the mind by creating the Model as per requirement by training it.
The Mind will have multiple number of Model's. One Model for one kind.
Then we should train the model as per requirement.
With python program, we create Model.
Predication:
By model creation and training the mind, we should best fit the relation to Predict/Guess the future results.
M.L has various approaches to Predict the Future result's.
One of the Continuous Model is Regression Model
for our example, it is Linear regression model as data is Linear in nature.
Supervised Learning:
In this, as we keep on hearing a thing we can visualize that in our Mind it is called Supervised Learning.
It will have Data(" X ") and Label(" Y ") in dataset.
Example:
If we hear a word(calling your name) from our Mom. we can Grasp the person of calling. This is by Supervised learning.
- Calling your name(myself Gaffoor) is X
- Mom is Y here
Note:
If We want a work to do by a device we need Program, it can be done by python by writing code.
The specific work can be done by " Function ".
- Function will be in Module, which is available from Library.
Ex:
While doing Image processing:
imread(Function) from cv2(Modules) from opencv(Library)
* By downloading Library, we can do anything programming.
Libraries are multiple and difficult to download each, so we use Anaconda(Distributor--> Pre-Installed Library)
to see library list, just type ' conda list ' in CMD prompt.
Linear Regression Model:
Example:
Will practice in stage-wise.
(1). Data set Stage:
(2). Model Training stage:
(3). Predicting Stage:
(4). Visualization:
* We have created a model which Continuous linear model. We can use(saving it) it for future usage by calling. This is called Training on a model.
For saving a model, In Skilearn module we have a function, lets do it and it will be like
Thus " mymarkmodel.pk1 ", became a Pre-Trained Model.
Image processing
let's continue our journey in Image processing:
Example: Cropping
(1.1) List:
Same analogy of cropping is used, some imp cases are also included in above pic.
(1.2) Cropping the pic:
(1.3) Green Remove
(1.4) Blue Removing
1.5) Red Removing
(1.6) Pure Red
(1.7) Pure Blue
(1.8) Pure Green
(1.9) Splitting BGR data from photo be like,
(1.10) Merging BGR data be like
(1.11) Let'splay with splitted cells to make our pic to Remove Red color
Note:
(1). When storing a program in python, we have to be careful in bracing them i.e.,
(2). Fullform of " uint8 " is
(3). Basics of merging assignment is done depending in simple python logic. i.e.,
This is called Multi-Assignment.
(4). += is Uniary Operator
(5). Photos is stored in binary form, when opening an image by imread(in cv2 module), it converts it into numpy array to understand.