Hey, I was facing a similar issue but I am not sure why it is working here (there are total 19 classes in cityscape dataset with one ignore label, since with ignore label there will be 20 classes, the model they should create must have 20 classes but it is not the case, they are using only 19 classes. When I try to do similar thing(although with a different pipeline), the assertion error of class comes). Please check this out, thanks in advance.

  
      github.com
  
  
    HRNet/HRNet-Semantic-Segmentation/blob/master/lib/datasets/cityscapes.py 21
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Ke Sun (sunk@mail.ustc.edu.cn)
# ------------------------------------------------------------------------------

import os

import cv2
import numpy as np
from PIL import Image

import torch
from torch.nn import functional as F

from .base_dataset import BaseDataset

class Cityscapes(BaseDataset):
    def __init__(self, 
                 root, 


  This file has been truncated. show original

  
  
    
    
  
  



  
      github.com
  
  
    HRNet/HRNet-Semantic-Segmentation/blob/master/lib/core/criterion.py 20
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Ke Sun (sunk@mail.ustc.edu.cn)
# ------------------------------------------------------------------------------

import torch
import torch.nn as nn
from torch.nn import functional as F

class CrossEntropy(nn.Module):
    def __init__(self, ignore_label=-1, weight=None):
        super(CrossEntropy, self).__init__()
        self.ignore_label = ignore_label
        self.criterion = nn.CrossEntropyLoss(weight=weight, 
                                             ignore_index=ignore_label)

    def forward(self, score, target):
        ph, pw = score.size(2), score.size(3)
        h, w = target.size(1), target.size(2)


  This file has been truncated. show original