本帖最后由 wtxx8888 于 2024-9-14 02:20 编辑
神农,需要自行添加代码。
编辑 _internal\DeepFaceLab\models\Model_SAEHD\Model.py 文件。
搜索紫色的 onGetPreview,添加蓝色的代码,即可显示LOSS,就三句。
def onGetPreview(self, samples, for_history=False, filenames=None):
( (warped_src, target_src, target_srcm, target_srcm_em),
(warped_dst, target_dst, target_dstm, target_dstm_em) ) = samples
src_loss, dst_loss = self.src_dst_train (warped_src, target_src, target_srcm, target_srcm_em, warped_dst, target_dst, target_dstm, target_dstm_em)
S, D, SS, DD, DDM, SD, SDM = [ np.clip( nn.to_data_format(x,"NHWC", self.model_data_format), 0.0, 1.0) for x in ([target_src,target_dst] + self.AE_view (target_src, target_dst) ) ]
DDM, SDM, = [ np.repeat (x, (3,), -1) for x in [DDM, SDM] ]
target_srcm, target_dstm = [ nn.to_data_format(x,"NHWC", self.model_data_format) for x in ([target_srcm, target_dstm] )]
n_samples = min(4, self.get_batch_size(), 800 // self.resolution )
if filenames is not None and len(filenames) > 0:
for i in range(n_samples):
S= label_face_filename(S, filenames[0])
SS = label_face_filename(SS, f'{src_loss:.4f}')
D = label_face_filename(D, filenames[1])
DD = label_face_filename(DD, f'{dst_loss:.4f}') |