You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我在使用您的BasicSR框架运行其中的HiFaceGAN人脸超分辨率模型时,训练前的构建模型阶段报错“KeyError: "No object named 'GANFeatLoss' found in 'loss' registry!"“,请问这个GANFeatLoss在哪个文件中,是否已经实现了呢?
When I was using your BasicSR framework to run the HiFaceGAN face super-resolution model, I encountered an error during the model building stage before training: "KeyError: "No object named 'GANFeatLoss' found in 'loss' registry!" Could you please tell me in which file the GANFeatLoss is located, and if it has already been implemented?
The text was updated successfully, but these errors were encountered:
看起来这几天没人关注,我自己根据HiFaceGAN的论文实现了一下GANFeatLoss。
It seems that no one has paid attention to this question in the past few days, so I implemented the GANFeatLoss based on the HiFaceGAN paper by myself.
import torch
from basicsr.utils.registry import LOSS_REGISTRY
from basicsr.losses.gan_loss import GANLoss
@LOSS_REGISTRY.register()
class GANFeatLoss(GANLoss):
def __init__(self, gan_type, real_label_val=1.0, fake_label_val=0.0, loss_weight=10.0):
super(GANFeatLoss, self).__init__(gan_type, real_label_val, fake_label_val, loss_weight)
self.FloatTensor = torch.cuda.FloatTensor
self.criterionFeat = torch.nn.L1Loss()
self.loss_weight = loss_weight
def forward(self, pred_fake, pred_real):
num_D = len(pred_fake)
GAN_Feat_loss = 0
for i in range(num_D): # for each discriminator
num_intermediate_outputs = len(pred_fake[i]) - 1
for j in range(num_intermediate_outputs): # for each layer output
unweighted_loss = self.criterionFeat(pred_fake[i][j], pred_real[i][j].detach())
GAN_Feat_loss += unweighted_loss * self.loss_weight / num_D
return GAN_Feat_loss
我在使用您的BasicSR框架运行其中的HiFaceGAN人脸超分辨率模型时,训练前的构建模型阶段报错“KeyError: "No object named 'GANFeatLoss' found in 'loss' registry!"“,请问这个GANFeatLoss在哪个文件中,是否已经实现了呢?
When I was using your BasicSR framework to run the HiFaceGAN face super-resolution model, I encountered an error during the model building stage before training: "KeyError: "No object named 'GANFeatLoss' found in 'loss' registry!" Could you please tell me in which file the GANFeatLoss is located, and if it has already been implemented?
The text was updated successfully, but these errors were encountered: