Metaclass database-style

This commit is contained in:
Florent Guiotte 2018-07-05 12:22:08 +02:00
parent 10aed66682
commit 3e4f5000f3
4 changed files with 109 additions and 5 deletions

View File

@ -105,10 +105,10 @@
"\n",
"split = np.zeros_like(gt)\n",
"\n",
"for lbl, lblc in zip(count[0][1:], count[1][1:]):\n",
"for lbli, lblc in zip(count[0][1:], count[1][1:]):\n",
" treshold = int(lblc * train_part)\n",
" #print('lbl:{}, count:{}, train:{}'.format(lbl, lblc, treshold))\n",
" f = np.nonzero(gt == lbl)\n",
" #print('lbli:{}, count:{}, train:{}'.format(lbli, lblc, treshold))\n",
" f = np.nonzero(gt == lbli)\n",
" split[f[0][:treshold], f[1][:treshold]] = 1\n",
" split[f[0][treshold:], f[1][treshold:]] = 2\n",
" \n",
@ -151,6 +151,15 @@
"# Metaclasses "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"gt"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -187,15 +196,55 @@
"outputs": [],
"source": [
"plt.figure(figsize=fs)\n",
"plt.imshow(gt * np.isin(gt, [10, 11]))#metaclasses_A['Roads']))\n",
"plt.imshow(gt * np.isin(gt, metaclasses_A['Roads']))\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"lbl"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"~~on~~"
"## Database-style"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dfc_lbl = pd.read_csv('../labels.csv')\n",
"meta_idx = pd.read_csv('../metaclass_indexes.csv')\n",
"meta_lbl = pd.read_csv('../metaclass_labels.csv')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dfc_meta_view = pd.merge(dfc_lbl, meta_idx)\n",
"all_meta_view = pd.merge(dfc_meta_view, meta_lbl)\n",
"all_meta_view"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"all_meta_view[all_meta_view['metaclass_index'] == 0]['index']"
]
}
],

22
labels.csv Normal file
View File

@ -0,0 +1,22 @@
index,label
0,Unclassified
1,Healthy grass
2,Stressed grass
3,Artificial turf
4,Evergreen trees
5,Deciduous trees
6,Bare earth
7,Water
8,Residential buildings
9,Non-residential buildings
10,Roads
11,Sidewalks
12,Crosswalks
13,Major thoroughfares
14,Highways
15,Railways
16,Paved parking lots
17,Unpaved parking lots
18,Cars
19,Trains
20,Stadium seats
1 index label
2 0 Unclassified
3 1 Healthy grass
4 2 Stressed grass
5 3 Artificial turf
6 4 Evergreen trees
7 5 Deciduous trees
8 6 Bare earth
9 7 Water
10 8 Residential buildings
11 9 Non-residential buildings
12 10 Roads
13 11 Sidewalks
14 12 Crosswalks
15 13 Major thoroughfares
16 14 Highways
17 15 Railways
18 16 Paved parking lots
19 17 Unpaved parking lots
20 18 Cars
21 19 Trains
22 20 Stadium seats

22
metaclass_indexes.csv Normal file
View File

@ -0,0 +1,22 @@
index,metaclass_index
0,0
1,1
2,1
3,1
4,2
5,2
6,3
7,0
8,4
9,4
10,5
11,5
12,5
13,5
14,5
15,6
16,5
17,0
18,7
19,8
20,9
1 index metaclass_index
2 0 0
3 1 1
4 2 1
5 3 1
6 4 2
7 5 2
8 6 3
9 7 0
10 8 4
11 9 4
12 10 5
13 11 5
14 12 5
15 13 5
16 14 5
17 15 6
18 16 5
19 17 0
20 18 7
21 19 8
22 20 9

11
metaclass_labels.csv Normal file
View File

@ -0,0 +1,11 @@
metaclass_index,metaclass_label
0,Unclassified
1,Grass
2,Trees
3,Bare earth
4,Buildings
5,Roads
6,Railways
7,Cars
8,Trains
9,Stadium
1 metaclass_index metaclass_label
2 0 Unclassified
3 1 Grass
4 2 Trees
5 3 Bare earth
6 4 Buildings
7 5 Roads
8 6 Railways
9 7 Cars
10 8 Trains
11 9 Stadium