This issue doesn’t seem to be directly related to PyTorch, so you might get faster and better answers on e.g. StackOverflow.
That being said, I guess that that original image might also contain these artifacts.
If the input image was just a binary image encoded as an RGB image, you could apply some smoothing and binarization to try to get rid of these noisy edges.