wenmengzhou commited on
Commit
1932d9e
·
verified ·
1 Parent(s): 7383609

add debug log

Browse files
Files changed (1) hide show
  1. webgui.py +4 -2
webgui.py CHANGED
@@ -164,6 +164,8 @@ lmk_extractor = LMKExtractor()
164
  def process_video(uploaded_img, uploaded_audio, width, height, length, facemask_dilation_ratio, facecrop_dilation_ratio, context_frames, context_overlap, cfg, steps, sample_rate, fps, device):
165
  #### face musk prepare
166
  face_img = cv2.imread(uploaded_img)
 
 
167
  face_mask = np.zeros((face_img.shape[0], face_img.shape[1])).astype('uint8')
168
  det_bboxes, probs = face_detector.detect(face_img)
169
  select_bbox = select_face(det_bboxes, probs)
@@ -185,8 +187,7 @@ def process_video(uploaded_img, uploaded_audio, width, height, length, facemask_
185
  face_mask = crop_and_pad(face_mask, crop_rect)
186
  face_img = cv2.resize(face_img, (width, height))
187
  face_mask = cv2.resize(face_mask, (width, height))
188
-
189
-
190
  # ==================== face_locator =====================
191
  '''
192
  driver_video = "./assets/driven_videos/c.mp4"
@@ -235,6 +236,7 @@ def process_video(uploaded_img, uploaded_audio, width, height, length, facemask_
235
  fps=fps,
236
  context_overlap=context_overlap
237
  ).videos
 
238
 
239
  save_dir = Path("output/tmp")
240
  save_dir.mkdir(exist_ok=True, parents=True)
 
164
  def process_video(uploaded_img, uploaded_audio, width, height, length, facemask_dilation_ratio, facecrop_dilation_ratio, context_frames, context_overlap, cfg, steps, sample_rate, fps, device):
165
  #### face musk prepare
166
  face_img = cv2.imread(uploaded_img)
167
+ if face_img is None:
168
+ raise gr.Error("input image should be uploaded or selected.")
169
  face_mask = np.zeros((face_img.shape[0], face_img.shape[1])).astype('uint8')
170
  det_bboxes, probs = face_detector.detect(face_img)
171
  select_bbox = select_face(det_bboxes, probs)
 
187
  face_mask = crop_and_pad(face_mask, crop_rect)
188
  face_img = cv2.resize(face_img, (width, height))
189
  face_mask = cv2.resize(face_mask, (width, height))
190
+ print('face detect done.')
 
191
  # ==================== face_locator =====================
192
  '''
193
  driver_video = "./assets/driven_videos/c.mp4"
 
236
  fps=fps,
237
  context_overlap=context_overlap
238
  ).videos
239
+ print('video pipe done.')
240
 
241
  save_dir = Path("output/tmp")
242
  save_dir.mkdir(exist_ok=True, parents=True)