Ques1: When there is a need to reshape dataset ?
Ans1: When we want to apply convolutions and we don’t have all the information about which pixels are near to each other for feature detection. By reshaping the dataset it is feasible to associate group of pixels to detect important features.
Reshape function in python for ASL(American Sign Language Dataset)
x_train.shape -> (274555, 784)
x_train.reshape(-1,28,28,1) -> (274555, 28, 28, 1)
As a convenience, we can pass the reshape method a -1
for any dimension we wish to remain the same.
Ques2: What is a need of Batch Normalization between hidden layers?
Ans2: Batch Normalization technique stabilizes the learning process and dramatically reduces the number of training epochs required to train deep neural networks. Python syntax for batch normalization –
from tensorflow.keras.layers import (
Dense,
Conv2D,
MaxPool2D,
Flatten,
Dropout,
BatchNormalization,
)
model = Sequential()
model.add(BatchNormalization())
Ques3: How we can check overfitting by looking at model training results?
Ans: If the difference between training loss and validation loss is more i.e. training loss is .1045(approx) and validation loss is .89432(approx) then this is the case of overfitting. To handle overfitting one way is to increase dataset size by creating more data with the help of rotation, translation and scaling.
to increase data, Python Keras Library comes with ImageDataGenerator class, it can be used as,
from tensorflow.keras.preprocessing.image import ImageDataGenerator
datagen = ImageDataGenerator(
rotation_range=10, # randomly rotate images in the range (degrees, 0 to 180)
zoom_range=0.1, # Randomly zoom image
width_shift_range=0.1, # randomly shift images horizontally (fraction of total width)
height_shift_range=0.1, # randomly shift images vertically (fraction of total height)
horizontal_flip=True, # randomly flip images horizontally
vertical_flip=False, # Don't randomly flip images vertically
)
Ques4: How to clean GPU memory?
Ans: The code to clean GPU memory is :
import IPython
app = IPython.Application.instance()
app.kernel.do_shutdown(True)
There’s certainly a great deal to learn about this topic.
I really like all the points you’ve made.
Thanks for finally writing about > Interesting Facts about
Deep Learning, Convolutional Neural Networks using Python –
. < Loved it!
I not to mention my buddies ended up reading the best ideas located on your site and then all of the sudden came up with a terrible feeling I had not thanked the web site owner for them. Most of the ladies came consequently very interested to study all of them and have simply been loving those things. Appreciate your getting considerably accommodating as well as for settling on this sort of high-quality resources millions of individuals are really desirous to be informed on. Our sincere regret for not expressing appreciation to you earlier.
I simply needed to thank you very much yet again. I am not sure the things that I would’ve achieved without the actual basics shown by you relating to this topic. Previously it was an absolute frightful concern in my position, however , considering a new specialized tactic you managed that made me to leap with delight. I’m just thankful for your guidance and believe you really know what an amazing job you happen to be carrying out educating the mediocre ones through the use of your webpage. Most probably you’ve never come across any of us.
Thank you a lot for giving everyone a very spectacular possiblity to read articles and blog posts from this site. It’s usually very pleasurable and also jam-packed with a lot of fun for me personally and my office colleagues to visit your site a minimum of thrice a week to see the latest items you have got. Not to mention, I am actually satisfied considering the good techniques served by you. Selected 2 tips in this posting are undeniably the most effective I have ever had.
Thanks so much for giving everyone remarkably memorable possiblity to read in detail from this web site. It’s usually very excellent and as well , stuffed with a lot of fun for me and my office colleagues to visit the blog at the very least thrice a week to study the fresh secrets you will have. And definitely, we are at all times fulfilled with all the magnificent ideas served by you. Some 4 tips in this posting are in reality the very best I have ever had.