Fcn_resnet101 for segemenation


I am new in using models. I have used fcn_resnet101 for images. I am trying to generate the mask for person in the image. However, the edges of mask are not proper. I have tried with multiple values of confidence. But there is always some issue with the edgestest2-enhancement9

tensor_int = read_image(str(Path(image)))

batch_int = torch.stack([tensor_int])
batch = convert_image_dtype(batch_int, dtype=torch.float)
#model = fcn_resnet50(pretrained=True, progress=False)
model = fcn_resnet101(pretrained=True, progress=False)

model = wide_resnet101_2(pretrained=True, progress=False)

model = model.eval()
normalized_batch = F.normalize(batch, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225))
output = model(normalized_batch)['out']

sem_classes = [

background’, ‘aeroplane’, ‘bicycle’, ‘bird’, ‘boat’, ‘bottle’, ‘bus’,
‘car’, ‘cat’, ‘chair’, ‘cow’, ‘diningtable’, ‘dog’, ‘horse’, ‘motorbike’,
‘person’, ‘pottedplant’, ‘sheep’, ‘sofa’, ‘train’, ‘tvmonitor’
sem_class_to_idx = {cls: idx for (idx, cls) in enumerate(sem_classes)}
normalized_masks = torch.nn.functional.softmax(output, dim=1)


person_masks = [
    normalized_masks[img_idx, sem_class_to_idx[cls]]
    for img_idx in range(batch.shape[0])
    #for cls in ['__background__']
    for cls in ['person']

Is there anything which can be done for better edges?