MCPcopy Create free account
hub / github.com/DragonisCV/RAM / setup_loss_functions

Method setup_loss_functions

ram/models/ram_base_model.py:77–83  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

75 self.optimizers.append(self.optimizer_g)
76
77 def setup_loss_functions(self):
78 train_opt = self.opt['train']
79 self.cri_pix = build_loss(train_opt['pixel_opt']).to(self.device) if train_opt.get('pixel_opt') else None
80 self.cri_perceptual = build_loss(train_opt['perceptual_opt']).to(self.device) if train_opt.get('perceptual_opt') else None
81
82 if self.cri_pix is None and self.cri_perceptual is None:
83 raise ValueError('Both pixel and perceptual losses are None.')
84
85 def feed_data(self, data):
86 self.gt = data['gt'].to(self.device)

Callers 2

Calls 2

build_lossFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected