Downloads · 30 days
29
18% of all-time downloads
Latitude-Attitude/vit-gps-coordinates-predictor
vit-gps-coordinates-predictor is a machine learning model from Latitude-Attitude. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
latmean = 39.951572994535354 latstd = 0.0006556104083785816 lonmean = -75.19137012508818 lonstd = 0.0006895844560639971
Downloads · 30 days
29
18% of all-time downloads
All-time downloads
161
Public
Repo size
1 GB
Likes
0
Public
Click a slice to open those files.
.pth346 MB · 50%
From the Hugging Face model README
lat_mean = 39.951572994535354 lat_std = 0.0006556104083785816 lon_mean = -75.19137012508818 lon_std = 0.0006895844560639971
from transformers import ViTModel class ViTGPSModel(nn.Module): def init(self, output_size=2): super().init() self.vit = ViTModel.from_pretrained("google/vit-base-patch16-224-in21k") self.regression_head = nn.Linear(self.vit.config.hidden_size, output_size)
def forward(self, x):
cls_embedding = self.vit(x).last_hidden_state[:, 0, :]
return self.regression_head(cls_embedding)
model_path = hf_hub_download(repo_id="Latitude-Attitude/vit-gps-coordinates-predictor", filename="vit-gps-coordinates-predictor.pth") model = torch.load(model_path) model.eval()
with torch.no_grad(): for images in dataloader: images = images.to(device) outputs = model(images) preds = outputs.cpu() * torch.tensor([lat_std, lon_std]) + torch.tensor([lat_mean, lon_mean])