![]() ![]() So as you can see it could only be used for a classification case and all options provided in a documentation specify only a way in which the class is provided to your classifier. flow_from_directory returns batches of a fixed size in a format of (picture, label).You need to have a directories structured in a following manner: directory with images\ I describe how to do this in great detail with examples here:Īt this moment (newest version of Keras from January 21st 2017) the flow_from_directory could only work in a following manner: This allows your generator to keep regression values and images properly synced even when you shuffle your data at each epoch. In short, create columns in your DataFrame containing the file path of each image and the target value. I think that organizing your data differently, using a DataFrame (without necessarily moving your images to new locations) will allow you to run a regression model. Train_generator = train_datagen.flow_from_dataframe(dataframe=train_label_df, directory=image_dir,Ĭlass_mode="other", target_size=(img_width, img_height), Width_shift_range = 0.2, height_shift_range=0.2, Train_datagen = ImageDataGenerator(rescale = 1./255, horizontal_flip = True, Here you can find an example where the images are in image_dir, the dataframe with the image IDs and the regression scores is loaded with pandas from the "train file" train_label_df = pd.read_csv(train_file, delimiter=' ', header=None, names=) You should store all your images in a folder and load a dataframe containing in one column the image IDs and in the other column the regression score (labels) and set class_mode='other' in flow_from_dataframe. ![]() With Keras 2.2.4 you can use flow_from_dataframe which solves what you want to do, allowing you to flow images from a directory for regression problems.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |