Update videoretalking/inference_function.py
Browse files
videoretalking/inference_function.py
CHANGED
@@ -14,8 +14,8 @@ from third_part.face3d.util.load_mats import load_lm3d
|
|
14 |
from third_part.face3d.extract_kp_videos import KeypointExtractor
|
15 |
# face enhancement
|
16 |
from third_part.GPEN.gpen_face_enhancer import FaceEnhancement
|
17 |
-
# expression control
|
18 |
-
from third_part.ganimation_replicate.model.ganimation import GANimationModel
|
19 |
|
20 |
from utils import audio
|
21 |
from utils.ffhq_preprocess import Croper
|
@@ -206,10 +206,10 @@ def video_lipsync_correctness(face, audio_path, outfile=None, tmp_dir="temp", cr
|
|
206 |
frame_h, frame_w = full_frames[0].shape[:-1]
|
207 |
out = cv2.VideoWriter('temp/{}/result.mp4'.format(tmp_dir), cv2.VideoWriter_fourcc(*'mp4v'), fps, (frame_w, frame_h))
|
208 |
|
209 |
-
if up_face != 'original':
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
|
214 |
kp_extractor = KeypointExtractor()
|
215 |
for i, (img_batch, mel_batch, frames, coords, img_original, f_frames) in enumerate(tqdm(gen, desc='[Step 6] Lip Synthesis:', total=int(np.ceil(float(len(mel_chunks)) / LNet_batch_size)))):
|
@@ -229,12 +229,12 @@ def video_lipsync_correctness(face, audio_path, outfile=None, tmp_dir="temp", cr
|
|
229 |
|
230 |
if up_face == 'original':
|
231 |
cur_gen_faces = img_original
|
232 |
-
else:
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
|
239 |
if without_rl1 is not False:
|
240 |
incomplete, reference = torch.split(img_batch, 3, dim=1)
|
|
|
14 |
from third_part.face3d.extract_kp_videos import KeypointExtractor
|
15 |
# face enhancement
|
16 |
from third_part.GPEN.gpen_face_enhancer import FaceEnhancement
|
17 |
+
# # expression control
|
18 |
+
# from third_part.ganimation_replicate.model.ganimation import GANimationModel
|
19 |
|
20 |
from utils import audio
|
21 |
from utils.ffhq_preprocess import Croper
|
|
|
206 |
frame_h, frame_w = full_frames[0].shape[:-1]
|
207 |
out = cv2.VideoWriter('temp/{}/result.mp4'.format(tmp_dir), cv2.VideoWriter_fourcc(*'mp4v'), fps, (frame_w, frame_h))
|
208 |
|
209 |
+
# if up_face != 'original':
|
210 |
+
# instance = GANimationModel()
|
211 |
+
# instance.initialize()
|
212 |
+
# instance.setup()
|
213 |
|
214 |
kp_extractor = KeypointExtractor()
|
215 |
for i, (img_batch, mel_batch, frames, coords, img_original, f_frames) in enumerate(tqdm(gen, desc='[Step 6] Lip Synthesis:', total=int(np.ceil(float(len(mel_chunks)) / LNet_batch_size)))):
|
|
|
229 |
|
230 |
if up_face == 'original':
|
231 |
cur_gen_faces = img_original
|
232 |
+
# else:
|
233 |
+
# test_batch = {'src_img': torch.nn.functional.interpolate((img_original * 2 - 1), size=(128, 128), mode='bilinear'),
|
234 |
+
# 'tar_aus': tar_aus.repeat(len(incomplete), 1)}
|
235 |
+
# instance.feed_batch(test_batch)
|
236 |
+
# instance.forward()
|
237 |
+
# cur_gen_faces = torch.nn.functional.interpolate(instance.fake_img / 2. + 0.5, size=(384, 384), mode='bilinear')
|
238 |
|
239 |
if without_rl1 is not False:
|
240 |
incomplete, reference = torch.split(img_batch, 3, dim=1)
|