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

GPS Coordinate Prediction Using Ensemble Models

This submission represents an ensemble of models trained to predict GPS coordinates. The ensemble combines predictions from three different model classes, each trained and optimized using distinct architectures. Below is an overview of the models and the ensemble process:

Model Overview

Model 1 (Adapted AlexNet)

  • Description: This model is an adapted version of the AlexNet architecture, modified for GPS coordinate prediction tasks.
  • Training Details:
  • Trained on the Testing_images and Training_images datasets from the CIS-5190-CIA repository.
  • A grid search was conducted to determine the best hyperparameters for learning rate and dropout rate.
  • Best Parameters:
  • Learning Rate (LR) = 0.0001
  • Dropout = 0.5
  • Using bagging, 5 independent models of the Model 1 class were trained on the mentioned datasets.

Model 2 (Adapted ResNet34)

  • Description: This model is based on ResNet34, adapted for the GPS prediction task by modifying its architecture.
  • Training Details:
  • Trained on the Testing_images and Training_images datasets from the CIS-5190-CIA repository.
  • A grid search was conducted to optimize learning rate, number of ResNet blocks, and dropout rate.
  • Best Parameters:
  • Learning Rate (LR) = 0.001
  • Number of Blocks = 3
  • Dropout = 0.5
  • Using bagging, 5 independent models of the Model 2 class were trained on the mentioned datasets.

Model 4 (Adapted Inception-v3 / GoogleNet)

  • Description: This model is an adapted version of Inception-v3 (GoogleNet), designed for GPS coordinate prediction tasks.
  • Training Details:
  • Trained on the Testing_images and Training_images datasets from the CIS-5190-CIA repository.
  • A grid search was conducted to optimize learning rate and dropout rate.
  • Best Parameters:
  • Learning Rate (LR) = 0.001
  • Dropout = 0.5
  • Using bagging, 4 independent models of the Model 4 class were trained on the mentioned datasets.

Ensemble Training

  • Description: The ensemble combines the predictions from 5 Model 1 instances, 5 Model 2 instances, and 4 Model 4 instances.
  • Dataset:
  • The ensemble was trained on the Testing_images_augmented and Training_images_augmented datasets from the CIS-5190-CIA repository.
  • Ensemble Method:
  • The ensemble weights were optimized using linear regression to attribute different weights to each model for the final prediction.

Ensemble Class

class EnsembleModel(nn.Module):
def __init__(self, models, num_models):
super(EnsembleModel, self).__init__()
self.models = nn.ModuleList(models)
self.weights = nn.Parameter(torch.ones(num_models) / num_models)

def forward(self, x):
outputs = torch.stack([model(x) for model in self.models], dim=-1)
weighted_output = torch.einsum('bij,j->bi', outputs, self.weights)
return weighted_output

Model Classes

Model 1

class Model1(nn.Module):
def __init__(self, dropout):
super(Model1, self).__init__()
self.features = nn.Sequential(
nn.Conv2d(3, 64, kernel_size=11, stride=4, padding=2),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=3, stride=2),
nn.Conv2d(64, 192, kernel_size=5, padding=2),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=3, stride=2),
nn.Conv2d(192, 384, kernel_size=3, padding=1),
nn.ReLU(inplace=True),
nn.Conv2d(384, 256, kernel_size=3, padding=1),
nn.ReLU(inplace=True),
nn.Conv2d(256, 256, kernel_size=3, padding=1),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=3, stride=2),
)
self.classifier = nn.Sequential(
nn.Dropout(p=dropout),
nn.Linear(256 * 6 * 6, 1024),
nn.ReLU(inplace=True),
nn.Dropout(p=dropout),
nn.Linear(1024, 512),
nn.ReLU(inplace=True),
nn.Linear(512, 2),
)

def forward(self, x):
x = self.features(x)
x = torch.flatten(x, 1)
x = self.classifier(x)
return x

Model 2

class Model2(nn.Module):
def __init__(self, num_blocks=3, dropout_rate=0.5):
super(Model2, self).__init__()

resnet = models.resnet34(pretrained=True)

for param in list(resnet.parameters())[:num_blocks]:
param.requires_grad = False

self.features = nn.Sequential(*list(resnet.children())[:-2])
self.avgpool = nn.AdaptiveAvgPool2d((1, 1))

self.classifier = nn.Sequential(
nn.Flatten(),
nn.Dropout(p=dropout_rate),
nn.Linear(resnet.fc.in_features, 512),
nn.ReLU(inplace=True),
nn.Dropout(p=dropout_rate),
nn.Linear(512, 2)
)

def forward(self, x):
x = self.features(x)
x = self.avgpool(x)
x = self.classifier(x)
return x

Model 4 (with Inception Modules)

class InceptionModule(nn.Module):
def __init__(self, in_channels, ch1x1, ch3x3_reduce, ch3x3, ch5x5_reduce, ch5x5, pool_proj):
super(InceptionModule, self).__init__()

self.branch1 = nn.Sequential(
nn.Conv2d(in_channels, ch1x1, kernel_size=1),
nn.ReLU(inplace=True)
)
self.branch2 = nn.Sequential(
nn.Conv2d(in_channels, ch3x3_reduce, kernel_size=1),
nn.ReLU(inplace=True),
nn.Conv2d(ch3x3_reduce, ch3x3, kernel_size=3, padding=1),
nn.ReLU(inplace=True)
)

self.branch3 = nn.Sequential(
nn.Conv2d(in_channels, ch5x5_reduce, kernel_size=1),
nn.ReLU(inplace=True),
nn.Conv2d(ch5x5_reduce, ch5x5, kernel_size=5, padding=2),
nn.ReLU(inplace=True)
)

self.branch4 = nn.Sequential(
nn.MaxPool2d(kernel_size=3, stride=1, padding=1),
nn.Conv2d(in_channels, pool_proj, kernel_size=1),
nn.ReLU(inplace=True)
)

def forward(self, x):
branch1 = self.branch1(x)
branch2 = self.branch2(x)
branch3 = self.branch3(x)
branch4 = self.branch4(x)
outputs = torch.cat([branch1, branch2, branch3, branch4], 1)
return outputs


class Model4(nn.Module):
def __init__(self, dropout_rate=0.5):
super(Model4, self).__init__()

self.pre_layers = nn.Sequential(
nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=3, stride=2, padding=1),
nn.Conv2d(64, 192, kernel_size=3, padding=1),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
)

self.inception1 = InceptionModule(192, 64, 96, 128, 16, 32, 32)
self.inception2 = InceptionModule(256, 128, 128, 192, 32, 96, 64)

self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)

self.inception3 = InceptionModule(480, 192, 96, 208, 16, 48, 64)
self.inception4 = InceptionModule(512, 160, 112, 224, 24, 64, 64)

self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
self.classifier = nn.Sequential(
nn.Flatten(),
nn.Dropout(p=dropout_rate),
nn.Linear(512, 1024),
nn.ReLU(inplace=True),
nn.Dropout(p=dropout_rate),
nn.Linear(1024, 512),
nn.ReLU(inplace=True),
nn.Linear(512, 2)
)

def forward(self, x):
x = self.pre_layers(x)
x = self.inception1(x)
x = self.inception2(x)
x = self.maxpool(x)
x = self.inception3(x)
x = self.inception4(x)
x = self.avgpool(x)
x = self.classifier(x)
return x

How to Run

In the notebook Run_ensable_2 (2).ipynb, replace the line:

dataset_test = load_dataset("gydou/released_img")

with the proper location of the testing dataset.

Training Dataset Statistics

lat_std = 0.0006914493505038013 
lon_std = 0.0006539239061573955 
lat_mean = 39.9517411499467
lon_mean =  -75.19143213125122
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model is not currently available via any of the supported third-party Inference Providers, and HF Inference API was unable to determine this model's library.