Update model.py
Browse files
model.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import torch
|
| 2 |
import torch.nn as nn
|
| 3 |
import numpy as np
|
|
|
|
| 4 |
from torchvision import transforms
|
| 5 |
from torchvision.models import resnet18, ResNet18_Weights
|
| 6 |
|
|
@@ -22,7 +23,7 @@ class ResNet18_M3(nn.Module):
|
|
| 22 |
|
| 23 |
def get_instance(self):
|
| 24 |
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 25 |
-
weights_path =
|
| 26 |
|
| 27 |
model = ResNet18_M3().to(DEVICE)
|
| 28 |
|
|
|
|
| 1 |
import torch
|
| 2 |
import torch.nn as nn
|
| 3 |
import numpy as np
|
| 4 |
+
import os
|
| 5 |
from torchvision import transforms
|
| 6 |
from torchvision.models import resnet18, ResNet18_Weights
|
| 7 |
|
|
|
|
| 23 |
|
| 24 |
def get_instance(self):
|
| 25 |
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 26 |
+
weights_path = os.path.join(os.path.dirname(__file__), "resnet18_m3_best.pth")
|
| 27 |
|
| 28 |
model = ResNet18_M3().to(DEVICE)
|
| 29 |
|