def label_read(path): if (os.path.exists(path)): pic = Image.open(path) transform = tv.transforms.Compose([LabelToLongTensor()]) label = transform(pic) else: label = torch.LongTensor(1, *size).fill_( 255) # Put label that will be ignored return label
def label_read(path): if os.path.exists(path): pic = Image.open(path) transform = tv.transforms.Compose( [tv.transforms.Resize(size, interpolation=Image.NEAREST), LabelToLongTensor()]) label = transform(pic) else: label = torch.LongTensor(1,*size).fill_(255) # Put label that will be ignored return label
def label_read(path): pic = Image.open(path) transform = tv.transforms.Compose([LabelToLongTensor()]) label = transform(pic) return label