Ignore the previous error, I’m using the linked code as shown above, Im using your code as below and im getting an error:"The shape of the mask [3, 1000] at index 0 does not match the shape of the indexed tensor [1000, 1000] at index 0"
**What are the values of h and w i should use, i Highly doubt im using the code properly
**
def getitem(self, idx):
    # load images ad masks

    img_path = os.path.join(self.root, "original_images", self.imgs[idx])

    mask_path = os.path.join(self.root, "col", self.masks[idx])

    img = Image.open(img_path).convert("RGB")

    # note that we haven't converted the mask to RGB,

    # because each color corresponds to a different instance

    # with 0 being background

    h, w = 1000, 1000

             

    mask = Image.open(mask_path)

    #mask = np.array(mask)

    # Create mapping

Get color codes for dataset (maybe you would have to use more than a single
image, if it doesn’t contain all classes)
    #target = torch.from_numpy(mask)

    target=self.transform(mask) #converts to tensor, resize to 1000x1000

    colors = torch.unique(target.view(-1, target.size(2)), dim=0).numpy()

    target = target.permute(2, 0, 1).contiguous()

    mapping = {tuple(c): t for c, t in zip(colors.tolist(), range(len(colors)))}

    mask = torch.empty(h, w, dtype=torch.long)

    for k in mapping:

# Get all indices for current class

      idx = (target==torch.tensor(k, dtype=torch.uint8).unsqueeze(1).unsqueeze(2))

      validx = (idx.sum(0) == 3)  # Check that all channels match

      mask[validx] = torch.tensor(mapping[k], dtype=torch.long)
      return self.transform(img), (mask)