Thanks, Sir, the problem was on my dataset and I fixed it, with this the accuracy is quite good but using that model and segmenting a single image is just not working. trans_img_tensor = T.Compose([                               T.Resize(256),                               T.CenterCrop(224),                               T.ToTensor() ]) image = Image.open('rose.jpeg') a = trans_img_tensor(image) c = a.unsqueeze(0) label = model(c) trans_tensor_2_img = T.Compose([                                 T.ToPILImage() ]) d = trans_tensor_2_img(label.argmax(1).float()) d