File size: 1,873 Bytes
3b88a01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Mean and STD:
  - lat_mean: 39.95177538047139
  - lat_std: 0.000688423824245344
  - lon_mean: -75.19147811784511
  - lon_std: 0.0006632296829719546

Implemented a ResNet50-based model using PyTorch: |
  import torch
  import torch.nn as nn
  from torchvision.models import resnet50

  class CustomResNet50(nn.Module):
      def __init__(self, num_classes=2):
          super().__init__()
          self.model = resnet50(pretrained=False)
          num_features = self.model.fc.in_features
          self.model.fc = nn.Linear(num_features, num_classes)

      def forward(self, x):
          return self.model(x)

Run the following code to access the model: |
  from huggingface_hub import hf_hub_download
  import torch
  import torch.nn as nn
  from torchvision.models import resnet50

  repo_id = "ImageGPSProj/ResNet50Model"
  filename = "custom_resnet50.pth"
  model_path = hf_hub_download(repo_id=repo_id, filename=filename)

  # Re-instantiate the architecture
  loaded_model = resnet50(pretrained=False)
  num_features = loaded_model.fc.in_features
  loaded_model.fc = nn.Linear(num_features, 2)

  # Load the state_dict
  state_dict = torch.load(model_path, map_location=torch.device('cpu'))
  loaded_model.load_state_dict(state_dict)

  loaded_model.eval()

dataset_info:
  features:
    - name: image
      dtype: image
    - name: Latitude
      dtype: float64
    - name: Longitude
      dtype: float64
  splits:
    - name: train
      num_bytes: 6747451504
      num_examples: 825
    - name: test
      num_bytes: 928890377
      num_examples: 105
    - name: val
      num_bytes: 791887265
      num_examples: 102
  download_size: 7405818019
  dataset_size: 8468229146
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
      - split: test
        path: data/test-*
      - split: val
        path: data/val-*