Update app.py
Browse files
app.py
CHANGED
|
@@ -7,16 +7,20 @@ import torchvision.transforms as transforms
|
|
| 7 |
from PIL import Image
|
| 8 |
import matplotlib.pyplot as plt
|
| 9 |
|
| 10 |
-
|
| 11 |
-
class GeoNet(nn.Module):
|
| 12 |
-
# Define your model architecture here
|
| 13 |
def __init__(self):
|
| 14 |
-
super(
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
def forward(self, x):
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
model = GeoNet()
|
| 22 |
model_path = 'model_geo_epoch79.pth'
|
|
|
|
| 7 |
from PIL import Image
|
| 8 |
import matplotlib.pyplot as plt
|
| 9 |
|
| 10 |
+
class geoNet(nn.Module):
|
|
|
|
|
|
|
| 11 |
def __init__(self):
|
| 12 |
+
super(geoNet, self).__init__()
|
| 13 |
+
self.name = "geo"
|
| 14 |
+
self.fc1 = nn.Linear(256*6*6, 244)
|
| 15 |
+
self.classifier = nn.Linear(244, 63) # Classification head
|
| 16 |
+
self.regressor = nn.Linear(244, 2) # Regression head for (latitude, longitude)
|
| 17 |
|
| 18 |
def forward(self, x):
|
| 19 |
+
x = x.view(x.size(0), -1)
|
| 20 |
+
x = F.relu(self.fc1(x))
|
| 21 |
+
province_pred = self.classifier(x)
|
| 22 |
+
coords_pred = self.regressor(x)
|
| 23 |
+
return province_pred, coords_pred
|
| 24 |
|
| 25 |
model = GeoNet()
|
| 26 |
model_path = 'model_geo_epoch79.pth'
|