Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Mean and STD:
|
2 |
+
- lat_mean: 39.95177538047139
|
3 |
+
- lat_std: 0.000688423824245344
|
4 |
+
- lon_mean: -75.19147811784511
|
5 |
+
- lon_std: 0.0006632296829719546
|
6 |
+
|
7 |
+
Implemented a ResNet50-based model using PyTorch: |
|
8 |
+
import torch
|
9 |
+
import torch.nn as nn
|
10 |
+
from torchvision.models import resnet50
|
11 |
+
|
12 |
+
class CustomResNet50(nn.Module):
|
13 |
+
def __init__(self, num_classes=2):
|
14 |
+
super().__init__()
|
15 |
+
self.model = resnet50(pretrained=False)
|
16 |
+
num_features = self.model.fc.in_features
|
17 |
+
self.model.fc = nn.Linear(num_features, num_classes)
|
18 |
+
|
19 |
+
def forward(self, x):
|
20 |
+
return self.model(x)
|
21 |
+
|
22 |
+
Run the following code to access the model: |
|
23 |
+
from huggingface_hub import hf_hub_download
|
24 |
+
import torch
|
25 |
+
import torch.nn as nn
|
26 |
+
from torchvision.models import resnet50
|
27 |
+
|
28 |
+
repo_id = "ImageGPSProj/ResNet50Model"
|
29 |
+
filename = "custom_resnet50.pth"
|
30 |
+
model_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
31 |
+
|
32 |
+
# Re-instantiate the architecture
|
33 |
+
loaded_model = resnet50(pretrained=False)
|
34 |
+
num_features = loaded_model.fc.in_features
|
35 |
+
loaded_model.fc = nn.Linear(num_features, 2)
|
36 |
+
|
37 |
+
# Load the state_dict
|
38 |
+
state_dict = torch.load(model_path, map_location=torch.device('cpu'))
|
39 |
+
loaded_model.load_state_dict(state_dict)
|
40 |
+
|
41 |
+
loaded_model.eval()
|
42 |
+
|
43 |
+
dataset_info:
|
44 |
+
features:
|
45 |
+
- name: image
|
46 |
+
dtype: image
|
47 |
+
- name: Latitude
|
48 |
+
dtype: float64
|
49 |
+
- name: Longitude
|
50 |
+
dtype: float64
|
51 |
+
splits:
|
52 |
+
- name: train
|
53 |
+
num_bytes: 6747451504
|
54 |
+
num_examples: 825
|
55 |
+
- name: test
|
56 |
+
num_bytes: 928890377
|
57 |
+
num_examples: 105
|
58 |
+
- name: val
|
59 |
+
num_bytes: 791887265
|
60 |
+
num_examples: 102
|
61 |
+
download_size: 7405818019
|
62 |
+
dataset_size: 8468229146
|
63 |
+
configs:
|
64 |
+
- config_name: default
|
65 |
+
data_files:
|
66 |
+
- split: train
|
67 |
+
path: data/train-*
|
68 |
+
- split: test
|
69 |
+
path: data/test-*
|
70 |
+
- split: val
|
71 |
+
path: data/val-*
|