forked from eecn/Hyperspectral-Classification
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_datasets.py
43 lines (38 loc) · 1.47 KB
/
custom_datasets.py
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
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)
}
}
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]
return img, gt, rgb_bands, ignored_labels, label_values, palette