Views
No views yet
| Property | Value |
|---|---|
| Architecture | UNet++ |
| Encoder | EfficientNet-B4 (ImageNet pretrained) |
| Framework | segmentation-models-pytorch (SMP) |
| Training Framework | PyTorch Lightning |
| Input | 3-channel RGB, 512x512 tiles |
| Output | 2-class mask (Background=0, Building=1) |
| Parameters | ~20.8M |
| Model Size | ~84 MB |
| Metric | Score |
|---|---|
| IoU | 0.9054 |
| Dice | 0.9503 |
| Best Val IoU | 0.9434 |
pip install geoai-py timm segmentation-models-pytorch1import geoai
2
3# Run building detection on a GeoTIFF
4geoai.timm_segmentation_from_hub(
5 input_path="input_image.tif",
6 output_path="building_prediction.tif",
7 repo_id="giswqs/whu-building-unetplusplus-efficientnet-b4",
8 window_size=512,
9 overlap=256,
10 batch_size=4,
11)
12
13# Vectorize to building footprints
14gdf = geoai.orthogonalize(
15 input_path="building_prediction.tif",
16 output_path="building_footprints.geojson",
17 epsilon=2.0,
18)1import json
2import torch
3import segmentation_models_pytorch as smp
4
5# Load config
6with open("config.json") as f:
7 config = json.load(f)
8
9# Create model
10model = smp.UnetPlusPlus(
11 encoder_name="efficientnet-b4",
12 encoder_weights=None,
13 in_channels=3,
14 classes=2,
15)
16
17# Load weights
18state_dict = torch.load("model.pth", map_location="cpu")
19model.load_state_dict(state_dict)
20model.eval()