meetps / pytorch-semseg

Semantic Segmentation Architectures Implemented in PyTorch
https://meetshah.dev/semantic-segmentation/deep-learning/pytorch/visdom/2017/06/01/semantic-segmentation-over-the-years.html
MIT License
3.39k stars 798 forks source link

RuntimeError: can't convert a given np.ndarray to a tensor #97

Closed HPL123 closed 5 years ago

HPL123 commented 6 years ago

@meetshah1995 @josephreisinger The first epoch is normal: Epoch [1/100] Loss: 3.4047 Epoch [1/100] Loss: 2.2006 Epoch [1/100] Loss: 1.7521 Epoch [1/100] Loss: 1.9977 Epoch [1/100] Loss: 1.9035 Epoch [1/100] Loss: 1.6435 Epoch [1/100] Loss: 1.4620 Epoch [1/100] Loss: 1.9718 Epoch [1/100] Loss: 0.9839 Epoch [1/100] Loss: 1.4327 Epoch [1/100] Loss: 1.5200 Epoch [1/100] Loss: 0.9417 Epoch [1/100] Loss: 1.3892 Epoch [1/100] Loss: 1.5654 Epoch [1/100] Loss: 1.4325 Epoch [1/100] Loss: 1.0973 Epoch [1/100] Loss: 1.2371 Epoch [1/100] Loss: 1.5081

But second epoch is wrong:

RuntimeError: Traceback (most recent call last): File "/home/hpl/anaconda2/envs/hpl36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 55, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/hpl/anaconda2/envs/hpl36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 55, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/hpl/code/2018/Face_parsing/pytorch-semseg-master/ptsemseg/loader/camvid_loader.py", line 47, in getitem img, lbl = self.transform(img, lbl) File "/home/hpl/code/2018/Face_parsing/pytorch-semseg-master/ptsemseg/loader/camvid_loader.py", line 64, in transform lbl = torch.from_numpy(lbl).long() RuntimeError: can't convert a given np.ndarray to a tensor - it has an invalid type. The only supported types are: double, float, int64, int32, and uint8.

yuyangyg commented 6 years ago

I met a same error

yuyangyg commented 6 years ago

lbl = m.imread(lbl_path) lbl = np.array(lbl, dtype=np.uint8)

HPL123 commented 6 years ago

@yuyangyg ,Hi. I get a bad test result, how about yours?

idlerm commented 6 years ago

Hello, is it convenient to say your email address? Some questions I would like to ask you

HPL123 commented 6 years ago

@idlerm ,email address: peilianghuang2017@gmail.com

idlerm commented 6 years ago

thank you

idlerm commented 6 years ago

Some questions have been sent to your email, thank you very much for your reply.

idlerm commented 6 years ago

Where is the 360 dataset downloaded? Thank you very much

HPL123 commented 5 years ago

@meetshah1995 @josephreisinger The first epoch is normal: Epoch [1/100] Loss: 3.4047 Epoch [1/100] Loss: 2.2006 Epoch [1/100] Loss: 1.7521 Epoch [1/100] Loss: 1.9977 Epoch [1/100] Loss: 1.9035 Epoch [1/100] Loss: 1.6435 Epoch [1/100] Loss: 1.4620 Epoch [1/100] Loss: 1.9718 Epoch [1/100] Loss: 0.9839 Epoch [1/100] Loss: 1.4327 Epoch [1/100] Loss: 1.5200 Epoch [1/100] Loss: 0.9417 Epoch [1/100] Loss: 1.3892 Epoch [1/100] Loss: 1.5654 Epoch [1/100] Loss: 1.4325 Epoch [1/100] Loss: 1.0973 Epoch [1/100] Loss: 1.2371 Epoch [1/100] Loss: 1.5081

But second epoch is wrong:

RuntimeError: Traceback (most recent call last): File "/home/hpl/anaconda2/envs/hpl36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 55, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/hpl/anaconda2/envs/hpl36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 55, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/hpl/code/2018/Face_parsing/pytorch-semseg-master/ptsemseg/loader/camvid_loader.py", line 47, in getitem img, lbl = self.transform(img, lbl) File "/home/hpl/code/2018/Face_parsing/pytorch-semseg-master/ptsemseg/loader/camvid_loader.py", line 64, in transform lbl = torch.from_numpy(lbl).long() RuntimeError: can't convert a given np.ndarray to a tensor - it has an invalid type. The only supported types are: double, float, int64, int32, and uint8.