glaucomasi commited on
Commit
e2fb451
·
1 Parent(s): ff5e792

added .gitignore

Browse files
Files changed (4) hide show
  1. .gitignore +1 -0
  2. 09_pretrained_effnetb2_20_percent.pth +0 -3
  3. app.py +2 -2
  4. model.py +1 -1
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ __pycache__
09_pretrained_effnetb2_20_percent.pth DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:82ad594c0f96d959e61d7828cf44760f9139b0e4f7c485764c1f0a368cd9241f
3
- size 31280955
 
 
 
 
app.py CHANGED
@@ -11,8 +11,8 @@ class_names = ["pizza", "steak", "sushi"]
11
 
12
  effnetb2, effnetb2_transforms = create_effnet2_model(num_classes=3)
13
  sd = load_file("09_pretrained_effnetb2_20_percent.safetensors")
14
- missing, unexpected = effnetb2.load_state_dict(sd, strict=True)
15
-
16
 
17
 
18
  def predict(img) -> Tuple[Dict, float]:
 
11
 
12
  effnetb2, effnetb2_transforms = create_effnet2_model(num_classes=3)
13
  sd = load_file("09_pretrained_effnetb2_20_percent.safetensors")
14
+ effnetb2.load_state_dict(sd, strict=True)
15
+ effnetb2.eval()
16
 
17
 
18
  def predict(img) -> Tuple[Dict, float]:
model.py CHANGED
@@ -5,7 +5,7 @@ from torch import nn
5
  def create_effnet2_model(num_classes: int=3):
6
  weights = torchvision.models.EfficientNet_B2_Weights.DEFAULT
7
  transforms = weights.transforms()
8
- model = torchvision.models.efficientnet_b2(weights=weights)
9
 
10
  for param in model.parameters():
11
  param.requires_grad = False
 
5
  def create_effnet2_model(num_classes: int=3):
6
  weights = torchvision.models.EfficientNet_B2_Weights.DEFAULT
7
  transforms = weights.transforms()
8
+ model = torchvision.models.efficientnet_b2(weights=None)
9
 
10
  for param in model.parameters():
11
  param.requires_grad = False