michaal94 / torch_DCEC

Pytorch Deep Clustering with Convolutional Autoencoders implementation
MIT License
98 stars 30 forks source link

Cannot handle this data type #3

Closed ssnvxia closed 5 years ago

ssnvxia commented 5 years ago

When I run the project with python3 torch_DCEC.py There is a typeError: "Cannot handle this data type"

details: `Traceback (most recent call last): File "/home/sym/anaconda3/lib/python3.6/site-packages/PIL/Image.py", line 2428, in fromarray mode, rawmode = _fromarray_typemap[typekey] KeyError: ((1, 1, 28), '|u1')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "torch_DCEC.py", line 373, in model = training_functions.train_model(model, dataloader, criteria, optimizers, schedulers, epochs, params) File "/home/sym/program/DCRE/DCEC/training_functions.py", line 35, in train_model pretrained_model = pretraining(model, copy.deepcopy(dl), criteria[0], optimizers[1], schedulers[1], pretrain_epochs, params) File "/home/sym/program/DCRE/DCEC/training_functions.py", line 287, in pretraining writer.addimage('Pretraining/Epoch' + str(epoch + 1).zfill(3) + '/Sample_' + str(img_counter).zfill(2), img) File "/home/sym/anaconda3/lib/python3.6/site-packages/tensorboardX/writer.py", line 533, in add_image image(tag, img_tensor, dataformats=dataformats), global_step, walltime) File "/home/sym/anaconda3/lib/python3.6/site-packages/tensorboardX/summary.py", line 224, in image image = make_image(tensor, rescale=rescale) File "/home/sym/anaconda3/lib/python3.6/site-packages/tensorboardX/summary.py", line 262, in make_image image = Image.fromarray(tensor) File "/home/sym/anaconda3/lib/python3.6/site-packages/PIL/Image.py", line 2431, in fromarray raise TypeError("Cannot handle this data type") TypeError: Cannot handle this data type `

michaal94 commented 5 years ago

Uhh, apparently something has changed for tensorboard (in terms of possible image inputs). I haven't touched this code for a while but I think it is fixed now.