I have three questions
first one is
how can I load local dataset of images and should these images be of same size and format??
second question is
should I always convert the image into numpy array and normalize it event if it is RGB not a gray scale??
third question is
in the ungraded exercise when setting number of characters per row to be printed why we set the linewidth to 320 and how we chose this number??
Q1:
Set the path
parameter when using load_data
to load a local images.
ImageDataGenerator is another way of loading images. You’ll see this in course 1 week 4.
From the perspective of course 1 week 2 (since you haven’t heard of custom models / layers), keep the input size and format the same.
Q2:
Inputs to neural networks should be scaled to small values (usually in range [0, 1]). So, unless your input has already been scaled, do it explicitly.
Q3:
In the 3rd exercise, the number of characters is set high enough to print a row of the array in 1 line. You should be able to set it to 115
and still get a clear print.
Thank you @balaji.ambresh I will wait for week 4 to find out load_data
Regarding normalization, unfortunately there was no difference in the result of exercise 7 that’s why I couldn’t get the reason behind normalization
and I tried to change 320 by 115 but the output wasn’t clear print
another question
how can I decide the number of epochs and dense layers or this is done by trial and error and for epochs I should use callbacks
I dont exactly know about 115 but if normalization is not at all affecting the accuracy of your model then may be the data you are passing is already normalized
Can you check that please
Regarding the number of epochs you generally keep it as 30 or so with call backs
Coming to number of dense layers,feel free to try some more combinations if you feel like
There is no hard and fast rule for that
Just that your last layer should contain the number of nodes =number of classes you have in your output
Q1
You have mnist.load_data
in the current assignment. You can provide a path likeload_data(path="somepath")
to load from local disk.
Here’s a snippet from the assignment that loads from a custom path.
# Load the data
# Get current working directory
current_dir = os.getcwd()
# Append data/mnist.npz to the previous path to get the full path
data_path = os.path.join(current_dir, "data/mnist.npz")
# Discard test set
(x_train, y_train), _ = tf.keras.datasets.mnist.load_data(path=data_path)
Week 4 should introduce you to ImageDataGenerator
Q2
Please read this link on feature scaling.
Q3
You get the general idea on why a number is set for controlling width of the output now. You can read more about this here
Q4
Number of epochs, number of dense layers etc. are configured based on the dataset / problem. See this link about hyperpameter optimization.