Does anyone know how to get the polygon masks from the inference results so I can then send some simple json across the wire to callers? I’m very unfamiliar with the Tensor output for the masks of the image during the segmentation inference.
model = torch.load(model_file)
model.to(device)

n_threads = torch.get_num_threads()
torch.set_num_threads(1)
model.eval()

def load_dataset():
    train_dataset = torchvision.datasets.ImageFolder(
        root="images",
        transform=torchvision.transforms.ToTensor()
    )
    train_loader = torch.utils.data.DataLoader(
        train_dataset,
        batch_size=1,
        num_workers=1,
        shuffle=True
    )
    return train_loader

for batch_idx, (data, target) in enumerate(load_dataset()):

    data = data.cuda()

    output = model(data)

    boxes = output[0]["boxes"]
    labels = output[0]["labels"]
    scores = output[0]["scores"]
    masks = output[0]["masks"]
    
    # how can I find the polygons for the masks in the tensors
    print(masks)
    
torch.cuda.empty_cache()