Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

name 'mp_face_mesh' is not defined #77

Open
andysingal opened this issue Sep 10, 2023 · 0 comments
Open

name 'mp_face_mesh' is not defined #77

andysingal opened this issue Sep 10, 2023 · 0 comments

Comments

@andysingal
Copy link

andysingal commented Sep 10, 2023

Hey Patrick,
i installed mediapipe, controlnet_aux but still getting error:

from diffusers.utils import load_image
from controlnet_aux.processor import Processor
import torch 

image = load_image( "https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/examples/sketch/human.png" )

image.save("human.png")



Loading base model ()...Done.
Removing last two layers (global_pool & classifier).
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[11], line 22
     20 for processor_id in processor_id_list:
     21     processor = Processor(processor_id)
---> 22     processed_image = processor(image, to_pil= True )
     24     processed_image.save(f"{processor_id}.png")

File /usr/local/lib/python3.10/dist-packages/controlnet_aux/processor.py:141, in Processor.__call__(self, image, to_pil)
    138 if isinstance(image, bytes):
    139     image = Image.open(io.BytesIO(image)).convert("RGB")
--> 141 processed_image = self.processor(image, **self.params)
    143 if to_pil:
    144     return processed_image

File /usr/local/lib/python3.10/dist-packages/controlnet_aux/mediapipe_face/__init__.py:42, in MediapipeFaceDetector.__call__(self, input_image, max_faces, min_confidence, output_type, detect_resolution, image_resolution, **kwargs)
     39 input_image = HWC3(input_image)
     40 input_image = resize_image(input_image, detect_resolution)
---> 42 detected_map = generate_annotation(input_image, max_faces, min_confidence)
     43 detected_map = HWC3(detected_map)
     45 img = resize_image(input_image, image_resolution)

File /usr/local/lib/python3.10/dist-packages/controlnet_aux/mediapipe_face/mediapipe_face_common.py:106, in generate_annotation(img_rgb, max_faces, min_confidence)
     96 def generate_annotation(
     97         img_rgb,
     98         max_faces: int,
     99         min_confidence: float
    100 ):
    101     """
    102     Find up to 'max_faces' inside the provided input image.
    103     If min_face_size_pixels is provided and nonzero it will be used to filter faces that occupy less than this many
    104     pixels in the image.
    105     """
--> 106     with mp_face_mesh.FaceMesh(
    107             static_image_mode=True,
    108             max_num_faces=max_faces,
    109             refine_landmarks=True,
    110             min_detection_confidence=min_confidence,
    111     ) as facemesh:
    112         img_height, img_width, img_channels = img_rgb.shape
    113         assert(img_channels == 3)

NameError: name 'mp_face_mesh' is not defined

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant