haihuynh commited on
Commit
cbb7990
·
verified ·
1 Parent(s): 0272604

Rename cbir_system.py to main.py

Browse files
Files changed (1) hide show
  1. cbir_system.py → main.py +11 -11
cbir_system.py → main.py RENAMED
@@ -22,18 +22,18 @@ with open('list_eval_partition.txt', 'r') as f:
22
  # For a model pretrained on VGGFace2
23
  print('Loading model weights ........')
24
 
25
- # class SiameseModel(nn.Module):
26
- # def __init__(self):
27
- # super().__init__()
28
- # self.backbone = InceptionResnetV1(pretrained='vggface2')
29
- # def forward(self, x):
30
- # x = self.backbone(x)
31
- # x = torch.nn.functional.normalize(x, dim=1)
32
- # return x
33
 
34
- # model = SiameseModel()
35
- # model.load_state_dict(torch.load('model.pt', map_location=torch.device('cpu')))
36
- # model.eval()
37
 
38
 
39
  # Make FAISS index
 
22
  # For a model pretrained on VGGFace2
23
  print('Loading model weights ........')
24
 
25
+ class SiameseModel(nn.Module):
26
+ def __init__(self):
27
+ super().__init__()
28
+ self.backbone = InceptionResnetV1(pretrained='vggface2')
29
+ def forward(self, x):
30
+ x = self.backbone(x)
31
+ x = torch.nn.functional.normalize(x, dim=1)
32
+ return x
33
 
34
+ model = SiameseModel()
35
+ model.load_state_dict(torch.load('model.pt', map_location=torch.device('cpu')))
36
+ model.eval()
37
 
38
 
39
  # Make FAISS index