elvisyjlin / AttGAN-PyTorch

AttGAN PyTorch Arbitrary Facial Attribute Editing: Only Change What You Want
MIT License
248 stars 61 forks source link

TypeError: can't convert np.ndarray of type numpy.int32. #7

Closed c1a1o1 closed 5 years ago

c1a1o1 commented 5 years ago

Traceback (most recent call last): File "F:/humanpose/AttGAN-PyTorch-master/train.py", line 121, in fixed_img_a, fixed_att_a = next(iter(valid_dataloader)) File "E:\Users\Raytine\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 314, in next batch = self.collate_fn([self.dataset[i] for i in indices]) File "E:\Users\Raytine\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 314, in batch = self.collate_fn([self.dataset[i] for i in indices]) File "F:\humanpose\AttGAN-PyTorch-master\data.py", line 46, in getitem att = torch.tensor((self.labels[index] + 1) // 2) TypeError: can't convert np.ndarray of type numpy.int32. The only supported types are: double, float, float16, int64, int32, and uint8.

elvisyjlin commented 5 years ago

I never saw this error. Can you provide more information such as 1) which command did you run? 2) which version of python, numpy, pytorch are you using?

c1a1o1 commented 5 years ago

--img_size 128 --shortcut_layers 1 --inject_layers 1 --experiment_name 128_shortcut1_inject1_none --gpu pytorch 0.4.1

elvisyjlin commented 5 years ago

I cannot reproduce your error. I'm using python 3 and pytorch 0.4.1. The following is my pip3 list.

Package         Version    
--------------- -----------
cloudpickle     0.8.0      
cycler          0.10.0     
dask            1.1.4      
decorator       4.3.2      
kiwisolver      1.0.1      
matplotlib      3.0.3      
networkx        2.2        
numpy           1.16.2     
Pillow          5.4.1      
pip             19.0.3     
protobuf        3.7.0      
pyparsing       2.3.1      
python-dateutil 2.8.0      
PyWavelets      1.0.2      
PyYAML          3.13       
scikit-image    0.14.2     
scipy           1.2.1      
setuptools      40.8.0     
six             1.12.0     
tensorboardX    1.6        
toolz           0.9.0      
torch           0.4.1      
torchvision     0.2.2.post3
tqdm            4.31.1     
wheel           0.33.1

Or perhaps you didn't create the correct dataset: data/img_align_celeba/*.jpg and data/list_attr_celeba.txt.

xiangjiawei110 commented 4 years ago

I also have the same problem. Does the landlord solve it?