Skip to content

unet_segmentation: swap tree-crown base checkpoint for a building-pre… - #58

Open
nilshof01 wants to merge 1 commit into
hotosm:developfrom
nilshof01:fix/unet-building-base
Open

unet_segmentation: swap tree-crown base checkpoint for a building-pre…#58
nilshof01 wants to merge 1 commit into
hotosm:developfrom
nilshof01:fix/unet-building-base

Conversation

@nilshof01

Copy link
Copy Markdown

…trained base

The shipped base (unet_resnet34_oam_rgb_tcd) is a tree-crown delineation model: zero-shot it scores building F1 0.00 on both held-out splits of hotosm/vhr-building-segmentation (n=7,237 val / 7,236 test chips), and fine-tuning from it reaches 50.0 pooled test F1 at 32 chips (6 regions x 5 folds) - below random decoder init (52.4).

An identical-architecture base pretrained on
hotosm/vhr-building-segmentation reaches 59.3 pooled (+9.3) with the unchanged fine-tune recipe, scores 0.40/0.51 building F1 zero-shot on the dataset val/test splits, and cuts fold variance. It is a raw smp state dict loading via the existing torch.load(weights_only=True) + load_state_dict(strict=False) path with 0 missing / 0 unexpected keys.

The checkpoint asset is pinned to the upload revision; training provenance is documented in the model README and on the checkpoint's model card (hf.co/nilsho01/unet-resnet34-vhr-buildings.

For more insights into the study have a look here for more insights: https://huggingface.co/nilsho01/unet-resnet34-vhr-buildings

…trained base

The shipped base (unet_resnet34_oam_rgb_tcd) is a tree-crown delineation
model: zero-shot it scores building F1 0.00 on both held-out splits of
hotosm/vhr-building-segmentation (n=7,237 val / 7,236 test chips), and
fine-tuning from it reaches 50.0 pooled test F1 at 32 chips (6 regions x
5 folds) - below random decoder init (52.4).

An identical-architecture base pretrained on
hotosm/vhr-building-segmentation reaches 59.3 pooled (+9.3) with the
unchanged fine-tune recipe, scores 0.40/0.51 building F1 zero-shot on
the dataset val/test splits, and cuts fold variance. It is a raw smp
state dict loading via the existing torch.load(weights_only=True) +
load_state_dict(strict=False) path with 0 missing / 0 unexpected keys.

The checkpoint asset is pinned to the upload revision; training
provenance is documented in the model README and on the checkpoint's
model card (hf.co/nilsho01/unet-resnet34-vhr-buildings).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kshitijrajsharma

Copy link
Copy Markdown
Member

Thanks for the PR , Can you explain a bit more what you are contributing to ?

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.07%. Comparing base (39285e4) to head (fc7a5b2).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop      #58   +/-   ##
========================================
  Coverage    97.07%   97.07%           
========================================
  Files           48       48           
  Lines         4271     4271           
========================================
  Hits          4146     4146           
  Misses         125      125           
Flag Coverage Δ
fair 96.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nilshof01

nilshof01 commented Aug 5, 2026

Copy link
Copy Markdown
Author

Hi, thank you for your reply and I hope I can contribute a bit :) As far as I understand it, the current pipeline for building segmentation has two options: a UNET baseline or a transformer. There are pros and cons in choosing either of them which is not part of this PR. However, I could see that the UNET baseline is a tree crown model, meaning that it finds trees and not buildings. It might still seem good enough for fine-tuning on chips, but in my measurements it is actually slightly worse than starting from a randomly initialized decoder. Hence, I trained a UNET base (resnet-34 backbone) on the dataset provided by hotosm for building segmentation (hotosm/vhr-building-segmentation). Across 6 distinct regions (Banepa, Jakarta, Accra, Bogota, Manila and Nairobi, 5-fold cross-validation each) the building-pretrained base reaches a pooled F1 of 59.3 as a fine-tuning warm start, versus 50.0 for the tree-crown base and 52.4 for no base at all — and comes close to the transformer (60.4) at a fifth of its size. So this PR is just about choosing the right UNET base checkpoint in the fine-tuning pipeline. It pins an exact updated version of the original model architecture, so nothing else in the pipeline needs to change. You can read more about the study here with the different metrics here: https://huggingface.co/nilsho01/unet-resnet34-vhr-buildings.
Would be happy to hear your thoughts!

@nilshof01

Copy link
Copy Markdown
Author

Hey,

I think it would be nice to discuss it since it is a simple change and has a more or less strong scientific foundation.

Br,
Nils

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants