Push model using huggingface_hub.
Browse files- README.md +1 -59
- model.safetensors +1 -1
README.md
CHANGED
@@ -6,62 +6,4 @@ tags:
|
|
6 |
|
7 |
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
|
8 |
- Library: [More Information Needed]
|
9 |
-
- Docs: [More Information Needed]
|
10 |
-
# Image to GPS Model: DINO-ResNet Fusion
|
11 |
-
|
12 |
-
## Training Data Statistics
|
13 |
-
The following mean and standard deviation values were used to normalize the GPS coordinates:
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
- **Latitude Mean**: {39.95156391970743}
|
19 |
-
- **Latitude Std**: {0.0007633062105681285}
|
20 |
-
- **Longitude Mean**: {-75.19148737056214}
|
21 |
-
- **Longitude Std**: {0.0007871346840888362}
|
22 |
-
|
23 |
-
## How to use the model
|
24 |
-
|
25 |
-
Please include the definition of the model first before loading the checkpoint:
|
26 |
-
|
27 |
-
```python
|
28 |
-
# Import all the dependencies
|
29 |
-
import torch
|
30 |
-
import torch.nn as nn
|
31 |
-
import torchvision.models as models
|
32 |
-
import torchvision.transforms as transforms
|
33 |
-
from torch.utils.data import DataLoader, Dataset
|
34 |
-
from transformers import AutoImageProcessor, AutoModelForImageClassification, AutoModel
|
35 |
-
from huggingface_hub import PyTorchModelHubMixin
|
36 |
-
from PIL import Image
|
37 |
-
import os
|
38 |
-
import numpy as np
|
39 |
-
|
40 |
-
class EfficientNetGPSModel(nn.Module, PyTorchModelHubMixin):
|
41 |
-
def __init__(self, eff_name="efficientnet_b0", num_outputs=2):
|
42 |
-
super(EfficientNetGPSModel, self).__init__()
|
43 |
-
|
44 |
-
# Load the EfficientNet backbone
|
45 |
-
self.efficientnet = getattr(models, eff_name)(pretrained=True)
|
46 |
-
|
47 |
-
# Replace the classifier head while keeping the overall structure simple
|
48 |
-
in_features = self.efficientnet.classifier[1].in_features
|
49 |
-
self.efficientnet.classifier = nn.Sequential(
|
50 |
-
nn.Linear(in_features, num_outputs) # Directly map to GPS coordinates
|
51 |
-
)
|
52 |
-
|
53 |
-
def forward(self, x):
|
54 |
-
return self.efficientnet(x)
|
55 |
-
|
56 |
-
def save_model(self, save_path):
|
57 |
-
self.save_pretrained(save_path)
|
58 |
-
|
59 |
-
def push_model(self, repo_name):
|
60 |
-
self.push_to_hub(repo_name)
|
61 |
-
```
|
62 |
-
|
63 |
-
Then you can download the model from HF by running, and this will also load the checkpoint automatically:
|
64 |
-
|
65 |
-
```python
|
66 |
-
model = EfficientNetGPSModel.from_pretrained("cis519/efficient-Net")
|
67 |
-
```
|
|
|
6 |
|
7 |
This model has been pushed to the Hub using the [PytorchModelHubMixin](https://huggingface.co/docs/huggingface_hub/package_reference/mixins#huggingface_hub.PyTorchModelHubMixin) integration:
|
8 |
- Library: [More Information Needed]
|
9 |
+
- Docs: [More Information Needed]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 16248448
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:05870049a37d6a945d8c2190813a19cc08c620f409d2787b4fd1d8557592a020
|
3 |
size 16248448
|