YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)

Image to GPS Model: DINO-ResNet Fusion

Training Data Statistics

The following mean and standard deviation values were used to normalize the GPS coordinates:

  • Latitude Mean: {39.95156391970743}
  • Latitude Std: {0.0007633062105681285}
  • Longitude Mean: {-75.19148737056214}
  • Longitude Std: {0.0007871346840888362}

How to use the model

Please include the definition of the model first before loading the checkpoint:

# Import all the dependencies
import torch
import torch.nn as nn
import torchvision.models as models
import torchvision.transforms as transforms
from torch.utils.data import DataLoader, Dataset
from transformers import AutoImageProcessor, AutoModelForImageClassification, AutoModel
from huggingface_hub import PyTorchModelHubMixin
from PIL import Image
import os
import numpy as np


class EfficientNetGPSModel(nn.Module, PyTorchModelHubMixin):
    def __init__(self, eff_name="efficientnet_b0", num_outputs=2):
        super(EfficientNetGPSModel, self).__init__()
        
        # Load the EfficientNet backbone
        self.efficientnet = getattr(models, eff_name)(pretrained=True)
        
        # Replace the classifier head while keeping the overall structure simple
        in_features = self.efficientnet.classifier[1].in_features
        self.efficientnet.classifier = nn.Sequential(
            nn.Linear(in_features, num_outputs)  # Directly map to GPS coordinates
        )

    def forward(self, x):
        return self.efficientnet(x)
    
    def save_model(self, save_path):
        self.save_pretrained(save_path)

    def push_model(self, repo_name):
        self.push_to_hub(repo_name)

Then you can download the model from HF by running, and this will also load the checkpoint automatically:

model = EfficientNetGPSModel.from_pretrained("cis519/efficient-Net")
Downloads last month
9
Safetensors
Model size
4.05M params
Tensor type
F32
·
Inference API
Unable to determine this model's library. Check the docs .