Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create models folder and move building_classifier files into it #53

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading