-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: NumpyArrayIterator is set to use the data format convention "channels_last" #3
Comments
Hi, sorry for the late reply. You could change the "image_data_format" from channels_last to channels_first in you Keras configuration file. (usually, it's at $HOME/.keras/keras.json) I think that would help to solve the issue. |
thanks for your reply, but this leads to another error...
|
you could simply add "drop_last=True" in torch.utils.data.DataLoader at line 92 in the original main.py : ) also refer to the other closed issue at #2 is necessary. |
thanks for your kindly help |
Excuse me, i have a question that cant solve for a long time.
I want to use your code to deal with clustering task by using NUS-WIDE dataset.
I organize these images on your suggestion in 'data' folder and put nus_lable.txt in 'meta' folder.
Then i add 'resize' operation in your 'mc_dataset.py'
It's just about:
1.from skimage.transform import resize
2.img = resize(img, (32, 32)) ------before 30 line
Besides, I just modified cifar10.yaml for:
small_bs: 16
workers: 4
num_classes: 4
Other than the above, I didn't modify any other files.(Except some notes I wrote)
But when i run 'main_2.py' using 'python main_2.py --config cfgs/cifar10.yaml'
(main_2.py is just a copy of main.py and added with my note)
It shows:
Traceback (most recent call last):
File "main_2.py", line 309, in
main()
File "main_2.py", line 140, in main
train(dataloader, model, dim_loss, crit_label, crit_graph, crit_c, optimizer, epoch, datagen, tb_logger)
File "main_2.py", line 203, in train
for X_batch_i in datagen.flow(input_bs,batch_size=args.small_bs,shuffle=False):
File "/home/sky/anaconda2/lib/python2.7/site-packages/keras/preprocessing/image.py", line 460, in flow
save_format=save_format)
File "/home/sky/anaconda2/lib/python2.7/site-packages/keras/preprocessing/image.py", line 782, in init
' (' + str(self.x.shape[channels_axis]) + ' channels).')
ValueError: NumpyArrayIterator is set to use the data format convention "channels_last" (channels on axis 3), i.e. expected either 1, 3 or 4 channels on axis 3. However, it was passed an array with shape (16, 3, 32, 32) (32 channels).
I dont know how to solve this problem.
Is something wrong for my modification?
Or your main.py has something need to revise?
I would appreciate it if you could help me solve this problem!
The text was updated successfully, but these errors were encountered: