Views
No views yet
| Model | Average R@1 | Average R@10 | Average R@100 |
|---|---|---|---|
| EarthLoc | 50.8 | 65.9 | 80.5 |
| EarthLoc2 | 79.6 | 90.0 | 95.5 |
1from model import DINOv2FeatureExtractor
2import torch
3
4# Set device
5DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
6
7# Path to the pretrained weights
8MODEL_CHECKPOINT_PATH = './weights/best_model_95.6.torch'
9
10# Initialize the model
11model = DINOv2FeatureExtractor(
12 model_type="vit_base_patch14_reg4_dinov2.lvd142m",
13 num_of_layers_to_unfreeze=0,
14 desc_dim=768,
15 aggregator_type="SALAD",
16)
17
18print('Loading model ...')
19# Load weights
20model_state_dict = torch.load(MODEL_CHECKPOINT_PATH, map_location=DEVICE)
21model.load_state_dict(model_state_dict)
22
23# Move model to device and set to evaluation mode
24model = model.to(DEVICE)
25model.eval()
26print('Model loaded.')
27
28# Print model parameters info
29num_params = sum(p.numel() for p in model.parameters())
30num_trainable = sum(p.numel() for p in model.parameters() if p.requires_grad)
31print(f"Model total parameters: {num_params:,}")
32print(f"Model trainable parameters: {num_trainable:,}")
33
34# Print aggregator type
35print(f"Aggregator type: {model.aggregator_type}")