Hi,
I have been trying to do this week’s practice (horses-or-humans) locally using a jupyter notebook. I’ve set downloaded both datasets (training and validation) and set them up in the data directory of my folder. I’ve modified my code to point to the directories containing these datasets relative to my working directory. Everything works fine up until I run model.fit() which produces this error:
__ array__() takes 1 positional argument but 2 were given.
I’m not sure why this is happening, I’ve set up all my parts of my code to work and I also looked in to the tensorflow documentation and ran the following command:
data_gen_args = dict(featurewise_center=True,
featurewise_std_normalization=True,
rotation_range=90,
width_shift_range=0.1,
height_shift_range=0.1,
zoom_range=0.2)
image_datagen = ImageDataGenerator(**data_gen_args)
mask_datagen = ImageDataGenerator(**data_gen_args)
seed = 1
image_datagen.fit(images, augment=True, seed=seed)
mask_datagen.fit(masks, augment=True, seed=seed)
image_generator = image_datagen.flow_from_directory(
train_dir,
class_mode=None,
seed=seed)
mask_generator = mask_datagen.flow_from_directory(
train_dir,
class_mode=None,
seed=seed)
train_generator = zip(image_generator, mask_generator)
model.fit(
train_generator,
steps_per_epoch=2000,
epochs=50)
Where I’ve set train_dir to be the directory that holds the directories which have the horses and humans images. Yet I still face the same error. I’ve also opened the google collab book in my local jupyter, and configured all the files to look on my local computer for the training and validation data yet I still get the same error. I’ve attached my code below along with images of my code, the error, and how I’ve set my directories up on my computer.
Course Folder: Contains Code (Horse-Human-Binary-Classifer) and Data Folder
Data Folder Within Course Folder
Validatation-horse-or-human folder
horse-or-human folder
Here is the code file I’ve used: Horse-Human-Binary-Classifer.ipynb (15.5 KB)
Please help and let me know if there is any additional information I need to provide.
I am working with on MacOS Catalina with tensorflow 2.7.0.