Downloads · 30 days
0
microsoft/SatCLIP-ViT16-L40
SatCLIP-ViT16-L40 is a machine learning model from microsoft. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Here, we provide accompanying information about our model SatCLIP. This repository is for the ViT16-L40 version of the model.
Downloads · 30 days
0
Access
Public
Updated Jan 16, 2024
Repo size
121 MB
Likes
5
Public
Click a slice to open those files.
.ckpt121 MB · 100%
From the Hugging Face model README
Here, we provide accompanying information about our model SatCLIP. This repository is for the ViT16-L40 version of the model.
SatCLIP is a model for contrastive pretraining of satellite image-location pairs. Training is analogous to the popular CLIP model.
SatCLIP includes an image and a location encoder. The image encoder processes multi-spectral satellite images of size [height, width, 13] into [d]-dimensional latent vectors. The location encoder processes location coordinates [longitude, latitude] into the same [d]-dimensional space.
SatCLIP is a model trained and tested for use in research projects. It is not intended for use in production environments.
The SatCLIP location encoder learns location characteristics, as captured by the satellite images, and can be deployed for downstream geospatial prediction tasks. Practically, this involves querying the location encoder for the [d]-dimensional vector embedding of all downstream locations and then using that embedding as predictor during downstream learning. In our paper, we show the useability of the learned location embeddings for predicting e.g. population density or biomes.
from huggingface_hub import hf_hub_download
from load import get_satclip
import torch
device = "cuda" if torch.cuda.is_available() else "cpu"
c = torch.randn(32, 2) # Represents a batch of 32 locations (lon/lat)
model = get_satclip(
hf_hub_download("microsoft/SatCLIP-ViT16-L40", "satclip-vit16-l40.ckpt"),
device=device,
) # Only loads location encoder by default
model.eval()
with torch.no_grad():
emb = model(c.double().to(device)).detach().cpu()
Potential use cases of SatCLIP which we did build the model for and did not test for include:
The following aspects should be considered before using SatCLIP:
Information about how to get started with SatCLIP training and deployment in downstream modelling can be found in our GitHub repository at github.com/microsoft/satclip.
SatCLIP is trained using the S2-100K dataset which samples 100,000 multi-spectral satellite image scenes from Sentinel-2 via the Microsoft Planetary Computer. Scenes are sampled approximately uniformly over landmass and are only chosen for the dataset if they don't exhibit cloud coverage. More details can be found in our paper.
SatCLIP is trained via contrastive learning, by matching the correct image-location pairs in a batch of images and locations. Each image and each location is processed within an encoder and trasformed into a [d]-dimensional embedding. The training objective is to minimize the cosine similarity of image and location embeddings.
The key hyperparameters of SatCLIP are: batch size, learning rate and weight decay. On top of this, the specific location and vision encoder come with their separate hyperparameters. Key hyperparameters for the location encoder include resolution-specific hyperparameters in the positional encoding (e.g. number of Legendre polynomials used for spherical harmonics calculation) and the type, number of layers and capacity of the neural network deployed. For the vision encoder, key hyperparameters depend on the type of vision backbone deployed (e.g. ResNet, Vision Transformer). More details can be found in our paper.
Training SatCLIP for 500 epochs using pretrained vision encoders takes aoughly 2 days on a single A100 GPU.
SatCLIP can be evaluated throughout training and during downstream deployment. During training, we log model loss on a held-out, unseen validation set to monitor the training process for potential overfitting. When SatCLIP embeddings are used in downstream applications, any predictive score can be used for evaluation, e.g. mean squared error (MSE) for regression or accuracy for classification problems.
BibTeX:
@article{klemmer2023satclip,
title={SatCLIP: Global, General-Purpose Location Embeddings with Satellite Imagery},
author={Klemmer, Konstantin and Rolf, Esther and Robinson, Caleb and Mackey, Lester and Russwurm, Marc},
journal={TBA},
year={2023}
}
For feedback and comments, contact kklemmer@microsoft.com.