Pytorch-UNet
Pytorch-UNet copied to clipboard
n_classes and Target size
Hi,
I'm training on a dataset with 1 class and a background. My masks are formatted with [0,1]. However, when I run train.py
with n_classes=1
, I get the error: Target 1 is out of bounds.
When training with n_classes=2
, all the output images are black. Is there a different way the masks should be formatted?
Thanks.
n_classes=2
with 0/1 targets should work. Where do you see the black images, in wandb or when running the predict script? Also, how long did you train the network for?
I want to know the label of the background,0/1 is multi label
In Binary problem , which like [0,1] case, u have to set "n_classes=2", not 1
Hello @milesial. Please reopen this issue as I am facing the exact same problem. Setting --classes
flag to 2 results in 0,1,2 values when running the prediction script using trained weights. It should only be resulting in 0,1 for binary segmentation. Am I missing something here? I trained my model for around 100 epochs.