AttributeError: 'module' object has no attribute 'stack' ......how to resolve this error

1,288 views
Skip to first unread message

narayan gour

unread,
Aug 9, 2016, 5:50:09 AM8/9/16
to Keras-users


i want to apply data Augmentation on my dataset images ....i have made list of images in form of numpy array ,float32 formate and divided it into train(70%) and test(30%) section nad than passing this train to "    datagen.fit(X_train)",,,,but it is giving error ...



    for X_batch, y_batch in datagen.flow(trainData, trainLabels, batch_size=3):
  File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 475, in next
    x = self.image_data_generator.random_transform(x.astype('float32'))
  File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 346, in random_transform
    fill_mode=self.fill_mode, cval=self.cval)
  File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 109, in apply_transform
    x = np.stack(channel_images, axis=0)
AttributeError: 'module' object has no attribute 'stack'

François Chollet

unread,
Aug 9, 2016, 3:13:05 PM8/9/16
to narayan gour, Keras-users
Update Numpy.

--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/3e835cb6-bb12-4967-bdc3-82f3257eeb9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

deeh...@gmail.com

unread,
Dec 12, 2016, 12:08:40 AM12/12/16
to Keras-users, ngo...@gmail.com
I had this same issue, with the updated version of numpy on Ubuntu 14.04 via an installation of pip. However I had installed the python-numpy package via apt-get. To resolve this, simply use pip's numpy via doing an apt-get remove.


On Wednesday, 10 August 2016 04:43:05 UTC+9:30, François Chollet wrote:
Update Numpy.

On 9 August 2016 at 02:50, narayan gour <ngo...@gmail.com> wrote:


i want to apply data Augmentation on my dataset images ....i have made list of images in form of numpy array ,float32 formate and divided it into train(70%) and test(30%) section nad than passing this train to "    datagen.fit(X_train)",,,,but it is giving error ...



    for X_batch, y_batch in datagen.flow(trainData, trainLabels, batch_size=3):
  File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 475, in next
    x = self.image_data_generator.random_transform(x.astype('float32'))
  File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 346, in random_transform
    fill_mode=self.fill_mode, cval=self.cval)
  File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 109, in apply_transform
    x = np.stack(channel_images, axis=0)
AttributeError: 'module' object has no attribute 'stack'

--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages