harshinde commited on
Commit
4ecc2b7
·
verified ·
1 Parent(s): ea3d7d2

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +84 -0
README.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ tags:
6
+ - earth-observation
7
+ - segmentation
8
+ - unet
9
+ - pytorch
10
+ - remote-sensing
11
+ - spacenet
12
+ datasets:
13
+ - harshinde/spacenet-rio
14
+ metrics:
15
+ - iou
16
+ - accuracy
17
+ - dice
18
+ pipeline_tag: image-segmentation
19
+ ---
20
+
21
+ # SpaceNet Rio Building Detection Model
22
+
23
+ This model detects building footprints from high-resolution satellite imagery. It is a PyTorch-based U-Net model trained on the **SpaceNet Area of Interest 1 (Rio de Janeiro)** dataset for semantic segmentation (binary: background vs. building).
24
+
25
+ ## Model Details
26
+
27
+ - **Architecture:** U-Net with residual connections, 4 encoder/decoder levels, 10% spatial dropout, and 1024-channel bottleneck.
28
+ - **Task:** Semantic Segmentation (Building Footprint Extraction)
29
+ - **Input:** 3-band (RGB) pan-sharpened GeoTIFFs (dynamic architecture also supports 8-band multispectral).
30
+ - **Output:** Binary mask (0: background, 1: building).
31
+ - **Parameters:** ~31M (Kaiming He initialized)
32
+ - **Framework:** PyTorch
33
+
34
+ ## Uses
35
+
36
+ ### Direct Use
37
+ This model can be used to automatically detect and extract building footprint masks from satellite imagery. It is primarily designed for high-resolution (e.g., ~50cm/pixel) RGB satellite tiles.
38
+
39
+ ### Out-of-Scope Use
40
+ - General object detection (e.g., cars, roads).
41
+ - Imagery with completely different spatial resolutions (e.g., 30m Landsat data) without fine-tuning.
42
+
43
+ ## Training Details
44
+
45
+ ### Dataset
46
+ Trained on the [SpaceNet Rio de Janeiro](https://huggingface.co/datasets/harshinde/spacenet-rio) dataset.
47
+ - **Total Tiles:** 6,940
48
+ - **Split:** 7:1:2 (Train: 4,857 | Val: 693 | Test: 1,387)
49
+
50
+ ### Hyperparameters
51
+ - **Epochs:** 100 (with early stopping patience of 15)
52
+ - **Batch Size:** 16 (Train) / 4 (Val)
53
+ - **Learning Rate:** 0.001 with 5 warmup epochs
54
+ - **Weight Decay:** 0.0001
55
+ - **Loss Function:** Combined Dice Loss (weight 1.0) + Cross-Entropy Loss (weight 1.0)
56
+ - **Image Crops:** 400x400 (Train) / 480x480 (Val)
57
+
58
+ ### Training Metrics
59
+ Training metrics were tracked using TensorBoard and include:
60
+ - Training/Validation Loss
61
+ - Mean IoU and Per-Class IoU
62
+ - Pixel Accuracy
63
+
64
+ You can view the full training logs and curves [here on TensorBoard](https://huggingface.co/harshinde/spacenet/tensorboard).
65
+
66
+ ## How to Get Started with the Model
67
+
68
+ You can load the weights using PyTorch:
69
+
70
+ ```python
71
+ import torch
72
+
73
+ # Assuming the U-Net architecture is defined in your local code
74
+ # model = UNet(in_channels=3, num_classes=2)
75
+
76
+ checkpoint = torch.load("best_model.pt", map_location="cpu")
77
+
78
+ # Depending on how the state dict was saved, load it into the model
79
+ # model.load_state_dict(checkpoint['model_state_dict']) # if saved as a dictionary
80
+ # OR
81
+ # model.load_state_dict(checkpoint) # if saved as raw state_dict
82
+
83
+ model.eval()
84
+ ```