Dynamic One-For-All (DOFA) reference implementation.
The requirements of DOFA can be installed as follows:
> pip install -r requirements.txt
Pre-trained model weights can be downloaded from HuggingFace.
Alternatively, DOFA can be used via the TorchGeo library:
import torch
from torchgeo.models import DOFABase16_Weights, dofa_base_patch16_224
# Example NAIP image (wavelengths in $\mu$m)
x = torch.rand(2, 4, 224, 224)
wavelengths = [0.48, 0.56, 0.64, 0.81]
# Use pre-trained model weights
model = dofa_base_patch16_224(weights=DOFABase16_Weights.DOFA_MAE)
# Make a prediction (model may need to be fine-tuned first)
y = model(x, wavelengths)