DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to fine-tune with Sentinel-2 pre-trained weights with Torchgeo

Start from multispectral ResNet18 weights trained on Sentinel-2 instead of RGB ImageNet weights for better transfer.

Short answer: Install with pip install torchgeo and timm; then import ResNet18_Weights from Torchgeo.models and pick ResNet18_Weights.SENTINEL2_ALL_MOCO; create the model with timm.create_model('resnet18', in_chans=weights.meta['in_chans'], num_classes=10). All steps.

Who it is forAn ML engineer with a small labeled multispectral dataset.

The problemImageNet weights only know RGB, while satellite data has many more bands.

The outcomeA timm ResNet18 with the right input channels loaded with SENTINEL2_ALL_MOCO weights.

What you need first

  • Python with `pip install torchgeo` (or `uv add torchgeo`)
  • Enough disk space for the satellite datasets you download
  • A GPU for training, as with any PyTorch project

Steps

  1. Install with pip install torchgeo and timm
  2. Import ResNet18_Weights from Torchgeo.models and pick ResNet18_Weights.SENTINEL2_ALL_MOCO
  3. Create the model with timm.create_model('resnet18', in_chans=weights.meta['in_chans'], num_classes=10)
  4. Load the weights with load_state_dict(weights.get_state_dict(progress=True, check_hash=True, weights_only=True), strict=False) and fine-tune

Prompt for your agent

Using torchgeo/torchgeo, load ResNet18_Weights.SENTINEL2_ALL_MOCO into a timm resnet18 with the right in_chans and set num_classes for <my label count>, then show a forward pass on a dummy batch.

Caveat. These weights can also be passed to TorchGeo Lightning tasks through the weights argument.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for torchgeo/torchgeo and "Fine-tune with Sentinel-2 pre-trained weights"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer