SHI-Labs / SGL-Retinal-Vessel-Segmentation

[MICCAI 2021] Study Group Learning: Improving Retinal Vessel Segmentation Trained with Noisy Labels: New SOTA on both DRIVE and CHASE_DB1.
https://arxiv.org/abs/2103.03451
MIT License
102 stars 24 forks source link

Bugs found when I run python main.py: ValueError: Can't write images with one color channel. #10

Open lzhzju opened 1 year ago

lzhzju commented 1 year ago

Process Process-13: Traceback (most recent call last): File "/home/lzh/anaconda3/envs/SGL/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap self.run() File "/home/lzh/anaconda3/envs/SGL/lib/python3.7/multiprocessing/process.py", line 99, in run self._target(*self._args, self._kwargs) File "/data1/lzh/workspace/retinal-image-segmentation-and-analysis/SGL-Retinal-Vessel-Segmentation/sgl_training/utility.py", line 139, in bg _target imageio.imwrite(filename, tensor.numpy()) File "/home/lzh/anaconda3/envs/SGL/lib/python3.7/site-packages/imageio/v2.py", line 397, in imwrite return file.write(im, kwargs) File "/home/lzh/anaconda3/envs/SGL/lib/python3.7/site-packages/imageio/plugins/pillow.py", line 405, in write raise ValueError("Can't write images with one color channel.") ValueError: Can't write images with one color channel.

Is this issue caused by an inappropriate version of imageio?

yzhouas commented 1 year ago

I am not sure which image is saved, but maybe imageio can only save images with shape (W, H) or (W, H, 3). You can try debug the shape of your output like: print(tensor.numpy().shape) to make sure the output shape is like that.

Another workaround is using opencv to save the image.