Dear friends, I am getting a noisy classified image inspite of getting test accuracy of 99 percent. I am using the following function for obtaining the classification map.
def classified_pixels(FPatches,gPatches,g):
  FPatches=np.reshape(FPatches,(FPatches.shape[0],FPatches.shape[3],FPatches.shape[1],FPatches.shape[2]))
  data_test=MyDataset(FPatches, gPatches)
  test_loader = torch.utils.data.DataLoader(data_test,batch_size=10,shuffle=False, num_workers=2)
  with torch.no_grad():
    correct = 0
    total = 0
    predicted_numpy=[]
    for images, labels in test_loader:
      images = images.to(device)
      labels = labels.to(device)
      outputs = model(images)
      _, predicted = torch.max(outputs.data, 1)
      predicted_numpy.append(predicted.cpu().numpy())
      total += labels.size(0)
      correct += (predicted == labels).sum().item()
  classification_map=np.array(predicted_numpy)
  cm=[]
  for arr in classification_map:
    cm.append(arr.tolist())
  cm=list(itertools.chain.from_iterable(cm))
  classification_map=np.array(cm)

  height=g.shape[0]
  width=g.shape[1]
  outputs = np.zeros((height,width))
  k=0
  for i in range(height):
    for j in range(width):
       target = g[i][j]
       if target == 0 :
         continue
       else :
        outputs[i][j]=classification_map[k]
       k=k+1
  return classification_map,outputs