LeeJunHyun / Image_Segmentation

Pytorch implementation of U-Net, R2U-Net, Attention U-Net, and Attention R2U-Net.
2.72k stars 600 forks source link

about label issue #3

Closed kangyang94 closed 5 years ago

kangyang94 commented 5 years ago

I change the background to 0 and others to 1 in my labels.But when I save the GT that is loaded from dataloader as a image, I get a image full of 0. Do you know why it happened?

LeeJunHyun commented 5 years ago

Dear @kangyang94 , can you share your code which change the background? may be, it should map 0 to 255, not 0 to 1. (I'm not sure.)

kangyang94 commented 5 years ago

I donot change the code. My label is a PIL image in 'L' mode. The region I want to segment set to 1 and the background to 0. But in solver.py , I change the GT from tensor to numpy, the array only has number 0.Do you know why it is? No matter I use GT_np = GT.cpu().data.numpy() or GT_np = GT.cpu().numpy(), GT_np only have 0.

kangyang94 commented 5 years ago

And the code may not have a test function?

LeeJunHyun commented 5 years ago

can you try GT_np = GT.cpu().data.numpy() 255 or GT_np = GT.cpu().numpy() 255??

LeeJunHyun commented 5 years ago

If you have no further questions, I will close the issue. I hope my answer was helpful.

kangyang94 commented 5 years ago

@LeeJunHyun Thank you very much.It works.