The easiest way is by going far away from them and staying away for a few minutes. If this method doesn't work i'd recommend switching the difficulty to peaceful to allow the pigmen to despawn before switching it back to your previous difficulty.