Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
ResearcherXman committed Feb 26, 2024
1 parent 8413732 commit 3437464
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 11 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ face_image = load_image("./examples/yann-lecun_resize.jpg")

# prepare face emb
face_info = app.get(cv2.cvtColor(np.array(face_image), cv2.COLOR_RGB2BGR))
face_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*x['bbox'][3]-x['bbox'][1])[-1] # only use the maximum face
face_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*(x['bbox'][3]-x['bbox'][1]))[-1] # only use the maximum face
face_emb = face_info['embedding']
face_kps = draw_kps(face_image, face_info['kps'])

Expand Down
7 changes: 1 addition & 6 deletions gradio_demo/app-multicontrolnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,7 @@ def generate_image(
f"Unable to detect a face in the image. Please upload a different photo with a clear face."
)

face_info = sorted(
face_info,
key=lambda x: (x["bbox"][2] - x["bbox"][0]) * x["bbox"][3] - x["bbox"][1],
)[
-1
] # only use the maximum face
face_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*(x['bbox'][3]-x['bbox'][1]))[-1] # only use the maximum face
face_emb = face_info["embedding"]
face_kps = draw_kps(convert_from_cv2_to_image(face_image_cv2), face_info["kps"])
img_controlnet = face_image
Expand Down
2 changes: 1 addition & 1 deletion gradio_demo/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def generate_image(face_image_path, pose_image_path, prompt, negative_prompt, st
if len(face_info) == 0:
raise gr.Error(f"Cannot find any face in the image! Please upload another person image")

face_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*x['bbox'][3]-x['bbox'][1])[-1] # only use the maximum face
face_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*(x['bbox'][3]-x['bbox'][1]))[-1] # only use the maximum face
face_emb = face_info['embedding']
face_kps = draw_kps(convert_from_cv2_to_image(face_image_cv2), face_info['kps'])

Expand Down
2 changes: 1 addition & 1 deletion infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def resize_img(input_image, max_side=1280, min_side=1024, size=None,
face_image = resize_img(face_image)

face_info = app.get(cv2.cvtColor(np.array(face_image), cv2.COLOR_RGB2BGR))
face_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*x['bbox'][3]-x['bbox'][1])[-1] # only use the maximum face
face_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*(x['bbox'][3]-x['bbox'][1]))[-1] # only use the maximum face
face_emb = face_info['embedding']
face_kps = draw_kps(face_image, face_info['kps'])

Expand Down
4 changes: 2 additions & 2 deletions infer_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def resize_img(input_image, max_side=1280, min_side=1024, size=None,
face_image = resize_img(face_image)

face_info = app.get(cv2.cvtColor(np.array(face_image), cv2.COLOR_RGB2BGR))
face_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*x['bbox'][3]-x['bbox'][1])[-1] # only use the maximum face
face_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*(x['bbox'][3]-x['bbox'][1]))[-1] # only use the maximum face
face_emb = face_info['embedding']

# use another reference image
Expand All @@ -88,7 +88,7 @@ def resize_img(input_image, max_side=1280, min_side=1024, size=None,

face_info = app.get(cv2.cvtColor(np.array(pose_image), cv2.COLOR_RGB2BGR))
pose_image_cv2 = convert_from_image_to_cv2(pose_image)
face_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*x['bbox'][3]-x['bbox'][1])[-1] # only use the maximum face
face_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*(x['bbox'][3]-x['bbox'][1]))[-1] # only use the maximum face
face_kps = draw_kps(pose_image, face_info['kps'])

width, height = face_kps.size
Expand Down

0 comments on commit 3437464

Please sign in to comment.