예제 #1
0
 def __init__(
     self,
     model='net-lin',
     net='alex',
     colorspace='rgb',
     spatial=False,
     use_gpu=True,
     gpu_ids=[
         0
     ]):  # VGG using our perceptually-learned weights (LPIPS metric)
     # def __init__(self, model='net', net='vgg', use_gpu=True): # "default" way of using VGG as a perceptual loss
     super(PerceptualLoss, self).__init__()
     print('Setting up Perceptual loss...')
     self.use_gpu = use_gpu
     self.spatial = spatial
     self.gpu_ids = gpu_ids
     self.model = dist_model.DistModel()
     self.model.initialize(model=model,
                           net=net,
                           use_gpu=use_gpu,
                           colorspace=colorspace,
                           spatial=self.spatial,
                           gpu_ids=gpu_ids)
     print('...[%s] initialized' % self.model.name())
     print('...Done')
예제 #2
0
파일: __init__.py 프로젝트: yyht/ilo
 def __init__(self,
              model='net-lin',
              net='alex',
              colorspace='rgb',
              spatial=False,
              use_gpu=True,
              gpu_ids=[0]):
     super(PerceptualLoss, self).__init__()
     self.use_gpu = use_gpu
     self.spatial = spatial
     self.gpu_ids = gpu_ids
     self.model = dist_model.DistModel()
     self.model.initialize(model=model,
                           net=net,
                           use_gpu=use_gpu,
                           colorspace=colorspace,
                           spatial=self.spatial,
                           gpu_ids=gpu_ids)
예제 #3
0
 def __init__(self,
              model='net-lin',
              net='emotion-vgg',
              colorspace='rgb',
              spatial=False,
              use_gpu=True,
              gpu_ids=[0]):
     super(EmotionLoss, self).__init__()
     print('Setting up Perceptual loss...')
     self.use_gpu = use_gpu
     self.spatial = spatial
     self.gpu_ids = gpu_ids
     self.model = dist_model.DistModel()
     self.model.initialize(model=model,
                           net=net,
                           use_gpu=use_gpu,
                           colorspace=colorspace,
                           spatial=self.spatial,
                           gpu_ids=gpu_ids)
     print('...[%s] initialized' % self.model.name())
     print('...Done')