Skip to content

Commit

Permalink
Merge pull request #53 from wri/feature/building_classifier_model
Browse files Browse the repository at this point in the history
Create models folder and move building_classifier files into it
  • Loading branch information
chrowe authored Jul 11, 2024
2 parents 6e2f03e + b3c4a0e commit 172f555
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions city_metrix/layers/smart_surface_lulc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from .layer import Layer, get_utm_zone_epsg, create_fishnet_grid, MAX_TILE_SIZE
from .open_street_map import OpenStreetMap, OpenStreetMapClass
from .building_classifier.building_classifier import BuildingClassifier
from ..models.building_classifier.building_classifier import BuildingClassifier


class SmartSurfaceLULC(Layer):
Expand All @@ -24,7 +24,7 @@ def get_data(self, bbox):
crs = get_utm_zone_epsg(bbox)

# load building roof slope classifier
with open('city_metrix/layers/building_classifier/building_classifier.pkl', 'rb') as f:
with open('city_metrix/models/building_classifier/building_classifier.pkl', 'rb') as f:
clf = pickle.load(f)

# ESA world cover
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
from exactextract import exact_extract
import pickle

from ..layer import Layer, get_utm_zone_epsg
from ..esa_world_cover import EsaWorldCover, EsaWorldCoverClass
from ..urban_land_use import UrbanLandUse
from ..average_net_building_height import AverageNetBuildingHeight
from ..open_street_map import OpenStreetMap, OpenStreetMapClass
from ..open_buildings import OpenBuildings
from ...layers.layer import Layer, get_utm_zone_epsg
from ...layers.esa_world_cover import EsaWorldCover, EsaWorldCoverClass
from ...layers.urban_land_use import UrbanLandUse
from ...layers.average_net_building_height import AverageNetBuildingHeight
from ...layers.open_street_map import OpenStreetMap, OpenStreetMapClass
from ...layers.open_buildings import OpenBuildings


class BuildingClassifier(Layer):
Expand Down Expand Up @@ -166,7 +166,7 @@ def building_classifier_tree(self):
# buildings_sample['ANBH'] = exact_extract(anbh_1m, buildings_sample, ["mean"], output='pandas')['mean']
# buildings_sample['Area_m'] = buildings_sample.geometry.area

# TODO: classifier parameters
# set classifier parameters
clf = DecisionTreeClassifier(max_depth=5)
# encode labels
buildings_sample['Slope_encoded'] = buildings_sample['Slope'].map({'low': np.int8(42), 'high': np.int8(40)})
Expand Down

0 comments on commit 172f555

Please sign in to comment.