import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
import torchvision.transforms as transforms
from collections import defaultdict, Counter
plt.style.use('default')
plt.rcParams['figure.dpi'] = 200
plt.rcParams['savefig.dpi'] = 200
"""Cityscapes dataset configuration class"""
# Cityscapes 19 main classes
'road', 'sidewalk', 'building', 'wall', 'fence',
'pole', 'traffic light', 'traffic sign', 'vegetation', 'terrain',
'sky', 'person', 'rider', 'car', 'truck',
'bus', 'train', 'motorcycle', 'bicycle'
# Class ID mapping (19 main classes)
7: 0, 8: 1, 11: 2, 12: 3, 13: 4,
17: 5, 19: 6, 20: 7, 21: 8, 22: 9,
23: 10, 24: 11, 25: 12, 26: 13, 27: 14,
28: 15, 31: 16, 32: 17, 33: 18
# Color mapping (for visualization)
(128/255, 64/255, 128/255), # road
(244/255, 35/255, 232/255), # sidewalk
(70/255, 70/255, 70/255), # building
(102/255, 102/255, 156/255), # wall
(190/255, 153/255, 153/255), # fence
(153/255, 153/255, 153/255), # pole
(250/255, 170/255, 30/255), # traffic light
(220/255, 220/255, 0/255), # traffic sign
(107/255, 142/255, 35/255), # vegetation
(152/255, 251/255, 152/255), # terrain
(70/255, 130/255, 180/255), # sky
(220/255, 20/255, 60/255), # person
(255/255, 0/255, 0/255), # rider
(0/255, 0/255, 142/255), # car
(0/255, 0/255, 70/255), # truck
(0/255, 60/255, 100/255), # bus
(0/255, 80/255, 100/255), # train
(0/255, 0/255, 230/255), # motorcycle
(119/255, 11/255, 32/255) # bicycle