Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 def label_read(path):
     pic = Image.open(path)
     transform = tv.transforms.Compose([LabelToLongTensor()])
     label = transform(pic)
     return label