check
Browse files- app.py +2 -2
- save_model.pkl → final_model.pkl +2 -2
app.py
CHANGED
|
@@ -11,7 +11,7 @@ from pl_bolts.transforms.dataset_normalizations import cifar10_normalization
|
|
| 11 |
|
| 12 |
model = ResNet18(0.00333)
|
| 13 |
|
| 14 |
-
state_model = torch.load("
|
| 15 |
state_dict = state_model.state_dict()
|
| 16 |
|
| 17 |
model.load_state_dict(state_dict, strict=False)
|
|
@@ -43,11 +43,11 @@ def inference(input_img, transparency = 0.5, target_layer_number = -1):
|
|
| 43 |
org_img = input_img
|
| 44 |
|
| 45 |
input_img = input_img.reshape((32, 32, 3))
|
| 46 |
-
input_img = cifar10_normalization()(input_img)
|
| 47 |
transform = transforms.ToTensor()
|
| 48 |
|
| 49 |
input_img = transform(input_img)
|
| 50 |
input_img = input_img.unsqueeze(0)
|
|
|
|
| 51 |
outputs = model(input_img)
|
| 52 |
softmax = torch.nn.Softmax(dim=0)
|
| 53 |
o = softmax(outputs.flatten())
|
|
|
|
| 11 |
|
| 12 |
model = ResNet18(0.00333)
|
| 13 |
|
| 14 |
+
state_model = torch.load("final_model.pkl", map_location=torch.device('cpu'))
|
| 15 |
state_dict = state_model.state_dict()
|
| 16 |
|
| 17 |
model.load_state_dict(state_dict, strict=False)
|
|
|
|
| 43 |
org_img = input_img
|
| 44 |
|
| 45 |
input_img = input_img.reshape((32, 32, 3))
|
|
|
|
| 46 |
transform = transforms.ToTensor()
|
| 47 |
|
| 48 |
input_img = transform(input_img)
|
| 49 |
input_img = input_img.unsqueeze(0)
|
| 50 |
+
input_img = cifar10_normalization()(input_img)
|
| 51 |
outputs = model(input_img)
|
| 52 |
softmax = torch.nn.Softmax(dim=0)
|
| 53 |
o = softmax(outputs.flatten())
|
save_model.pkl → final_model.pkl
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b232c13b46d9c87644f33fe59e6c691c490b567f9a819d5ca46b7de5aeb6e20
|
| 3 |
+
size 532818376
|