def METHOD_NAME(self, ann):
    boxes = []
    masks = []
    labels = []
    def mask_to_tight_box(mask):
        a = mask.nonzero()
        bbox = [
            torch.min(a[:, 1]),
            torch.min(a[:, 0]),
            torch.max(a[:, 1]),
            torch.max(a[:, 0]),
        ]
        bbox = list(map(int, bbox))
        return bbox  # xmin, ymin, xmax, ymax
    # Sort for consistent order between instances as the polygon annotation
    instIds = torch.sort(torch.unique(ann))[0]
    for instId in instIds:
        if instId < 1000:  # group labels
            continue
        mask = ann == instId
        label = int(instId / 1000)
        label = self.cityscapesID_to_ind[label]
        box = mask_to_tight_box(mask)
        boxes.append(box)
        masks.append(mask)
        labels.append(label)
    return boxes, masks, labels