Spaces:
Sleeping
Sleeping
Delete SimSwap/models/fs_model.py
Browse files- SimSwap/models/fs_model.py +0 -36
SimSwap/models/fs_model.py
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
|
2 |
-
import torch
|
3 |
-
from .base_model import BaseModel
|
4 |
-
from . import networks
|
5 |
-
|
6 |
-
class FSModel(BaseModel):
|
7 |
-
def name(self):
|
8 |
-
return 'FSModel'
|
9 |
-
|
10 |
-
def initialize(self, opt):
|
11 |
-
BaseModel.initialize(self, opt)
|
12 |
-
self.opt = opt
|
13 |
-
self.device = torch.device("cpu")
|
14 |
-
|
15 |
-
self.netG = networks.define_G(opt, self.device)
|
16 |
-
self.netArc = networks.define_arcface(opt, self.device)
|
17 |
-
|
18 |
-
self.load_network(self.netG, 'G', opt.which_epoch, opt.load_pretrain)
|
19 |
-
self.load_network(self.netArc, 'arc', opt.which_epoch, opt.load_pretrain)
|
20 |
-
|
21 |
-
self.netG.eval()
|
22 |
-
self.netArc.eval()
|
23 |
-
|
24 |
-
def set_input(self, opt, id_feature):
|
25 |
-
self.image_paths = opt.pic_a_path
|
26 |
-
self.id_feature = id_feature
|
27 |
-
|
28 |
-
def forward(self):
|
29 |
-
with torch.no_grad():
|
30 |
-
self.fake_B = self.netG(self.id_feature, self.image_paths)
|
31 |
-
|
32 |
-
def test(self):
|
33 |
-
self.forward()
|
34 |
-
|
35 |
-
def get_current_visuals(self):
|
36 |
-
return {'synthesized_image': self.fake_B}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|