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