forked from nshaud/DeepHyperX
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcustom_datasets.py
More file actions
111 lines (99 loc) · 2.71 KB
/
custom_datasets.py
File metadata and controls
111 lines (99 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
from utils import open_file
import numpy as np
CUSTOM_DATASETS_CONFIG = {
"DFC2018_HSI": {
"img": "2018_IEEE_GRSS_DFC_HSI_TR.HDR",
"gt": "2018_IEEE_GRSS_DFC_GT_TR.tif",
"download": False,
"loader": lambda folder: dfc2018_loader(folder),
},
"Mauzac": {
"img": "mauzac_img.npy",
"gt": "mauzac_gt.npy",
"download": False,
"loader": lambda folder: mauzac_loader(folder),
},
"Toulouse": {
"img": "toulouse_img.npy",
"gt": "toulouse_gt.npy",
"download": False,
"loader": lambda folder: toulouse_loader(folder),
}
}
def dfc2018_loader(folder):
img = open_file(folder + "2018_IEEE_GRSS_DFC_HSI_TR.HDR")[:, :, :-2]
gt = open_file(folder + "2018_IEEE_GRSS_DFC_GT_TR.tif")
gt = gt.astype("uint8")
rgb_bands = (47, 31, 15)
label_values = [
"Unclassified",
"Healthy grass",
"Stressed grass",
"Artificial turf",
"Evergreen trees",
"Deciduous trees",
"Bare earth",
"Water",
"Residential buildings",
"Non-residential buildings",
"Roads",
"Sidewalks",
"Crosswalks",
"Major thoroughfares",
"Highways",
"Railways",
"Paved parking lots",
"Unpaved parking lots",
"Cars",
"Trains",
"Stadium seats"
]
ignored_labels = [0]
palette = None
return img, gt, rgb_bands, ignored_labels, label_values, palette
def mauzac_loader(folder):
img = open_file(folder + "mauzac_img.npy")
gt = open_file(folder + "mauzac_gt.npy")
gt = gt.astype("uint8")
rgb_bands = (70, 50, 25)
label_values = [
'Untitled',
'Vegetation shadows',
'High vegetation',
'Ground vegetation',
'Dry vegetation',
'Bare soil',
'Water body',
'Swimming pool',
'Pool cover',
'Curbstone',
'Tile',
'Asphalt',
'Other shadows'
]
ignored_labels = [0]
palette = None
return img, gt, rgb_bands, ignored_labels, label_values, palette
def toulouse_loader(folder):
img = open_file(folder + "toulouse_img.npy")
gt = open_file(folder + "toulouse_gt.npy")
gt = gt.astype("uint8")
rgb_bands = (70, 50, 25)
label_values = [
'Untitled',
'Vegetation shadows',
'High vegetation',
'Ground vegetation',
'Dry vegetation',
'Bare soil',
'Water body',
'Swimming pool',
'Pool cover',
'Curbstone',
'Tile',
'Asphalt',
'Other shadows'
]
ignored_labels = [0]
palette = None
return img, gt, rgb_bands, ignored_labels, label_values, palette