Skip to content
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: not enough image data #358

Open
lsm11111 opened this issue Apr 13, 2022 · 0 comments
Open

ValueError: not enough image data #358

lsm11111 opened this issue Apr 13, 2022 · 0 comments

Comments

@lsm11111
Copy link

(lsm) s802@s802:~/lsm/Pytorch-UNet-master$ python /home/s802/lsm/Pytorch-UNet-master/predict.py -i /home/s802/lsm/Pytorch-UNet-master/1.jpg -o /home/s802/lsm/Pytorch-UNet-master/output.jpg
/home/s802/anaconda3/envs/lsm/lib/python3.6/site-packages/torch/cuda/init.py:52: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 10010). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:100.)
return torch._C._cuda_getDeviceCount() > 0
pic: <class 'torch.Tensor'>
mode: RGB
Traceback (most recent call last):
File "/home/s802/lsm/Pytorch-UNet-master/predict.py", line 107, in
device=device)
File "/home/s802/lsm/Pytorch-UNet-master/predict.py", line 39, in predict_img
full_mask = tf(probs.cpu()).squeeze()
File "/home/s802/anaconda3/envs/lsm/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 50, in call
img = t(img)
File "/home/s802/anaconda3/envs/lsm/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 113, in call
return F.to_pil_image(pic, self.mode)
File "/home/s802/anaconda3/envs/lsm/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 149, in to_pil_image
return Image.fromarray(npimg, mode=mode)
File "/home/s802/anaconda3/envs/lsm/lib/python3.6/site-packages/PIL/Image.py", line 2857, in fromarray
return frombuffer(mode, size, obj, "raw", rawmode, 0, 1)
File "/home/s802/anaconda3/envs/lsm/lib/python3.6/site-packages/PIL/Image.py", line 2793, in frombuffer
return frombytes(mode, size, data, decoder_name, args)
File "/home/s802/anaconda3/envs/lsm/lib/python3.6/site-packages/PIL/Image.py", line 2739, in frombytes
im.frombytes(data, decoder_name, args)
File "/home/s802/anaconda3/envs/lsm/lib/python3.6/site-packages/PIL/Image.py", line 814, in frombytes
raise ValueError("not enough image data")
ValueError: not enough image data

the input image is RGB,but when it in image.py it has only two channels,so it output the error .But i do not know how to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant