Spanicin commited on
Commit
8d04433
·
verified ·
1 Parent(s): 14d23fb

Update src/facerender/modules/make_animation.py

Browse files
src/facerender/modules/make_animation.py CHANGED
@@ -3,6 +3,7 @@ import torch
3
  import torch.nn.functional as F
4
  import numpy as np
5
  from tqdm import tqdm
 
6
 
7
  def normalize_kp(kp_source, kp_driving, kp_driving_initial, adapt_movement_scale=False,
8
  use_relative_movement=False, use_relative_jacobian=False):
@@ -154,11 +155,16 @@ def make_animation(source_image, source_semantics, target_semantics,
154
  source_semantics = source_semantics.to(device)
155
  target_semantics = target_semantics.to(device)
156
 
 
157
  with torch.no_grad(): # No gradients needed
158
  predictions = []
 
159
  kp_canonical = kp_detector(source_image)
160
  he_source = mapping(source_semantics)
161
  kp_source = keypoint_transformation(kp_canonical, he_source)
 
 
 
162
 
163
  with autocast():
164
  for frame_idx in tqdm(range(target_semantics.shape[1]), desc='Face Renderer:', unit='frame'):
 
3
  import torch.nn.functional as F
4
  import numpy as np
5
  from tqdm import tqdm
6
+ import time
7
 
8
  def normalize_kp(kp_source, kp_driving, kp_driving_initial, adapt_movement_scale=False,
9
  use_relative_movement=False, use_relative_jacobian=False):
 
155
  source_semantics = source_semantics.to(device)
156
  target_semantics = target_semantics.to(device)
157
 
158
+
159
  with torch.no_grad(): # No gradients needed
160
  predictions = []
161
+ start = time.time()
162
  kp_canonical = kp_detector(source_image)
163
  he_source = mapping(source_semantics)
164
  kp_source = keypoint_transformation(kp_canonical, he_source)
165
+ end = time.time()
166
+ diff = end-start
167
+ print("time taken for 3 values within make animation:", diff)
168
 
169
  with autocast():
170
  for frame_idx in tqdm(range(target_semantics.shape[1]), desc='Face Renderer:', unit='frame'):