Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to find data adapter that can handle input: <class 'numpy.ndarray'>, (<class 'list'> containing values of types {"<class 'int'>"})

history = model.fit(X, y, batch_size=32, epochs=40, validation_split=0.1)

the line problem was this

Showing error:

ValueError: Failed to find data adapter that can handle input: <class 'numpy.ndarray'>, (<class 'list'> containing values of types {"<class 'int'>"})
like image 588
Neo Avatar asked Nov 03 '19 16:11

Neo


3 Answers

I was facing the same issue. Turns out it was a in the form of a list. I had to convert the fields into a numpy array like:

training_padded = np.array(training_padded)
training_labels = np.array(training_labels)
testing_padded = np.array(testing_padded)
testing_labels = np.array(testing_labels)

thats it!

like image 193
Atharva Avatar answered Nov 05 '22 02:11

Atharva


ValueError in TensorFlow

https://pythonprogramming.net/convolutional-neural-network-deep-learning-python-tensorflow-keras/

I tried following code and worked for me:

IMG_SIZE = 50

X = np.array(X).reshape(-1, IMG_SIZE, IMG_SIZE, 1)

y = np.array(y)

history = model.fit(X, y, batch_size=32, epochs=40, validation_split=0.1)
like image 17
Rostam Avatar answered Nov 05 '22 03:11

Rostam


So this is happening the the newer version of tensorflow I'm not sure from where but I was on version 2.0.0 and this same thing happened

I'm assuming that you are only converting the X array into a numpy array But rather try converting 'X' as well as 'y' to numpy array using the dtype as np.uint8

That should resolve the problem

like image 15
VIKI Avatar answered Nov 05 '22 02:11

VIKI