Anda di halaman 1dari 22

CONVOLUTIONAL NEURAL

NETWORKS FOR IMAGE


CLASSIFICATION
Presented by prashanth sama
16311A05V3
Contents:
 Artificial neural network
 Disadvantages of traditional ANN in image processing
 Computer vision
 Challenges in image classification
 Introduction
 Techniques in CNN
 Case Study
 Python code
 Conclusion
 References
Artificial Neural Network
 Artificial neural network is a
deep learning technique
 It performs well in many
artificial intelligence tasks
 Like speech recognition,
regression, classification etc.
 ANN requires high
computation and memory
Artificial Neural Network

 ANN is available in different


flavors like
 Feedforward Neural Network
 Convolutional Neural Network
 Recurrent Neural Network etc..
Disadvantages of traditional neural network in image processing

• As image as represented in matrix format an image of size


640*480 will have features equals 3,07,200 input neuron
should need at the input layer and hidden layer contains
2/3 of input neuron and output neuron has neuron equals to
number of classes
•So image of that requires a large computations for
classification and it to require lot of time , memory
•Here several disadvantages of traditional ANN , gave birth
to the Convolutional Neural Network
Computer Vision

•Computer Vision, often abbreviated as CV, is defined as a


field of study that seeks to develop techniques to help
computers “see” and understand the content of digital
images such as photographs and videos
•With enormous increase in the digital image and video
data the need of analysing those gain pretty much
importance and knowledge that gained through analysing
those data is of much value and it find its application in
medical health care , satellite image sensing
Challenges in Image processing

• analysing a image is not simple as it appears , analysing


the image requires high computation ,memory and time
•Every year several new techniques as proposed to deal
with the image processing
•One of such techniques is Convolutional Neural Network
Introduction to CNN
 CNNs, like neural networks, are made up of neurons with
learnable weights and biases. Each neuron receives several
inputs, takes a weighted sum over them, pass it through an
activation function and responds with an output. The whole
network has a loss function and all the tips and tricks that we
developed for neural networks still apply on CNNs.
 Untill this point you feel both the ANN and CNN feel similar.
But they are not similar you can find CNN as extension to ANN
with added features like padding , pooling , convolution , stride
, filter.
Techniques in CNN

Convolution:
Max - Pooling:
Stride and padding:
 Stride controls how the filter
convolves around the input volume
 Padding : Every time we apply a
convolutional operation, the size of
the image shrinks
 Pixels present in the corner of the
image are used only a few number
of times during convolution as
compared to the central pixels.
Hence, we do not focus too much on
the corners since that can lead to
information loss
Case Study
 Each product has multiple views (front, left, right,
back) and only a few views have the information
about the product through which you can make the
ML model learn its features. Build ML model and
explain your approach on how will you select the
specific view from the given set of different views.
 Example: In the case of footwear, Side
view(left/right) has most information regarding the
type of heel (high, medium or flat).Similarly,
different views have different information for each
use case.
Python code to Download images
import pandas as pd
import os
import urllib.request
direc_name = os.path.dirname(os.path.abspath(__file__))
image_dir = os.path.join(direc_name,"images")
df = pd.read_csv("Internship_data - Internship_data.csv")
df.fillna(axis="columns",method = "ffill",inplace=True)
views = ['view_1','view_2','view_3','view_4','view_5']
lst = df["class"].unique()
names_num = []
for i in range(2500):
if i < 10:
names_num.append("000"+str(i))
elif i < 100:
names_num.append("00"+str(i))
elif i < 1000:
names_num.append("0"+str(i))
else:
names_num.append(str(i))
for p in lst:
k=0
photo_dir = os.path.join(image_dir,p)
for i in views:
lst_url = df[df['class']==p][i]
for j in lst_url:

urllib.request.urlretrieve(j,photo_dir+"\\"+i+names_num[k]+".png")
k=k+1
 ret,mask =
cv2.threshold(gray,220,255,cv2.THRESH_B
INARY_INV)
 mask_inv = cv2.bitwise_not(mask)

 image_bg = cv2.bitwise_and(roi,roi,mask
= mask_inv)
 cv2.rectangle(gray,(min_by,min_bx),(max_
by,max_bx),(0,255,0),1)
Conclusion
 CNN provides effective and efficient techniques
for image analysis
 There are several deep learning frameworks
available to make the work more easy
 It has several application in various domains like
health care etc
Reference
 https://www.analyticsvidhya.com/blog/2018/12/gui
de-convolutional-neural-network-cnn/
 https://medium.com/technologymadeeasy/the-best-
explanation-of-convolutional-neural-networks-on-the-
internet-fbb8b1ad5df8
 https://github.com/ipashi/Convolutional_neural_netwo
rk/blob/master/convolutional_network_tutorial.ipynb
 https://blog.gofynd.com/machine-learning-internship-
challenge-2019-6b4e9dddb637

Anda mungkin juga menyukai