I'm trying to organize image files I have into a Pandas dataframe. I'm using Keras's preprocessing library for working with them. Here's how I load them in:
from keras.preprocessing.image import load_img
from keras.preprocessing.image import img_to_array
from keras.preprocessing.image import array_to_img
filename_file = pd.DataFrame(columns = ['Filename', 'File'])
for filename in os.listdir(""):
new_filename = filename
if(filename[0] == '.'):
new_filename = filename[2:]
pic = load_img(new_filename)
picture = img_to_array(pic)
filename_file = filename_file.append({'Filename' : new_filename, 'File' : picture}, ignore_index = True)
My goal is to slice off the File
column of the filename_file
dataframe. I want its shape to be (11000, 350, 350, 3) because I have 11000 images, each one 350 by 350 pixels and 3 for RGB. The issue I'm having is that the dimensions become (11000, 1). How can I get the data in the format I want?