-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdemo_terrain_filter.py
More file actions
21 lines (16 loc) · 884 Bytes
/
demo_terrain_filter.py
File metadata and controls
21 lines (16 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
from utils.nx_graph import nx_graph_write
from terrainFilter.terrain_filter import TerrainFilter
from terrainFilter.tif_processing import readDEMTif, readSatMapTifSegNet
depot = (10, 10)
target_graph_shape = (256, 256)
DEM_tif = readDEMTif(os.path.join('data', 'geo_data', 'DEM', 'terrain1.tif'))
filtered_DEM = TerrainFilter.filterDEM(DEM_tif)
satmap_tif = readSatMapTifSegNet(os.path.join('data', 'geo_data', 'satmap', 'terrain1.tif'))
pklPath = os.path.join('data', 'models', 'args.pkl')
modelPath = os.path.join('data', 'models', 'checkpoint_step_10000.pth')
satmap_seg = TerrainFilter.filterSatMap(satmap_tif, pklPath, modelPath)
fused_map = TerrainFilter.fuseFilteredMap(filtered_DEM, satmap_seg, depot)
G = TerrainFilter.generateSpanningGraph(fused_map, depot, DEM_tif, target_graph_shape)
TerrainFilter.display(G, 128, 128)
# nx_graph_write(G, 'terrain.graph')