I’m trying to break down the get_data function that Jeremy created and I have some questions. Here is my current code:
%matplotlib inline from keras.preprocessing import image import numpy as np import matplotlib from matplotlib import pyplot as plt idg = image.ImageDataGenerator() train_img = idg.flow_from_directory("label_train_img",target_size=(224,224), batch_size=1) data = train_img.next() plt.imshow(data)
This gives me the following image (Just the picture part, not the black outline):
My thought is that I must have done something wrong with the RGB, but I’m not even sure how to modify that or see what each of those looks like. I am hoping somebody can point me in the right direction and provide some links to look into this further. I have had some issues with accuracy and I think this is the problem.
Besides this issue though, I believe what the get_data() function that Jeremy created does is pulls data using the flow_from_directory function built into keras for preprocessing images, then iterates through that using a loop that gives a batch of values at a time, but Jeremy uses a batch size of 1 here so that every image gets read in without having to do an extra loop. He also has class_mode=None which is important because if you don’t have that, you will get a "ValueError: all the input arrays must have same number of dimensions
" error. That’s where I am on this so far. I have gotten a lot more familiar with what is actually happening behind the scenes on this.
Hopefully this can maybe be helpful to somebody and maybe somebody will be able to figure out my image issues.