acmyu commited on
Commit
a89b10b
·
1 Parent(s): 26ea696

resize image before gen pose

Browse files
Files changed (1) hide show
  1. main.py +5 -2
main.py CHANGED
@@ -216,7 +216,7 @@ def get_pose(img, dwpose, outfile, crop=False):
216
  #pil_image = Image.open("imgs/"+img).convert("RGB")
217
  #skeleton = dwpose(pil_image, output_type="np", include_hands=True, include_face=False)
218
 
219
- #img.thumbnail((512,512))
220
  out_img, pose = dwpose(img, include_hands=True, include_face=False)
221
 
222
  #print(pose['bodies'])
@@ -299,6 +299,9 @@ def prepare_inputs_inference(in_img, in_vid, frames, fps, dwpose, rembg_session,
299
  print(frames)
300
  if in_vid:
301
  frames = extract_frames(in_vid, fps)
 
 
 
302
  print("remove background", bg_remove)
303
  if bg_remove:
304
  in_img = removebg(in_img, rembg_session)
@@ -1180,7 +1183,7 @@ def run_inference_impl(images, video_path, frames, train_steps=100, inference_st
1180
  gc.collect()
1181
  torch.cuda.empty_cache()
1182
 
1183
- return out_vid+'.webm', results, getThumbnails(results), target_poses_coords, getThumbnails(orig_frames)
1184
 
1185
  def run_inference(images, video_path, frames, train_steps=100, inference_steps=10, fps=12, modelId="fine_tuned_pcdms", img_width=1920, img_height=1080, bg_remove=True, resize_inputs=True):
1186
  return run_inference_impl(images, video_path, frames, train_steps, inference_steps, fps, modelId, img_width, img_height, bg_remove, resize_inputs)
 
216
  #pil_image = Image.open("imgs/"+img).convert("RGB")
217
  #skeleton = dwpose(pil_image, output_type="np", include_hands=True, include_face=False)
218
 
219
+ img.thumbnail((512,512))
220
  out_img, pose = dwpose(img, include_hands=True, include_face=False)
221
 
222
  #print(pose['bodies'])
 
299
  print(frames)
300
  if in_vid:
301
  frames = extract_frames(in_vid, fps)
302
+ for f in frames:
303
+ f.thumbnail((512,512))
304
+
305
  print("remove background", bg_remove)
306
  if bg_remove:
307
  in_img = removebg(in_img, rembg_session)
 
1183
  gc.collect()
1184
  torch.cuda.empty_cache()
1185
 
1186
+ return out_vid+'.webm', results, getThumbnails(results), target_poses_coords, orig_frames
1187
 
1188
  def run_inference(images, video_path, frames, train_steps=100, inference_steps=10, fps=12, modelId="fine_tuned_pcdms", img_width=1920, img_height=1080, bg_remove=True, resize_inputs=True):
1189
  return run_inference_impl(images, video_path, frames, train_steps, inference_steps, fps, modelId, img_width, img_height, bg_remove, resize_inputs)