Mastering Image Segmentation with PyTorch: From Fundamentals to Advanced Implementation