google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.72k stars 5.18k forks source link

Can't instantiate binary graph for face_geometry_from_landmarks and face_geometry_from_detection #2294

Closed RafaelMiquelino closed 3 years ago

RafaelMiquelino commented 3 years ago

Please make sure that this is a build/installation issue and also refer to the troubleshooting documentation before raising any issues.

System information (Please provide as much relevant information as possible)

Describe the problem:

I compiled face_geometry_from_landmarks and face_geometry_from_detection to get the binary graphs and call it from python with the mp.CalculatorGraph but I can't make it work. I always get the following errors:

For face_geometry_from_landmarks.binarypb:

RuntimeError: ValidatedGraphConfig Initialization failed.
No registered object with name: FaceGeometryPipelineCalculator; Unable to find Calculator "FaceGeometryPipelineCalculator"

For face_geometry_from_detection:

RuntimeError: ValidatedGraphConfig Initialization failed.
No registered object with name: DetectionToLandmarksCalculator; Unable to find Calculator "DetectionToLandmarksCalculator"
No registered object with name: FaceGeometryPipelineCalculator; Unable to find Calculator "FaceGeometryPipelineCalculator"

I checked the dependencies on the mediapipe/modules/face_geometry/BUILD file and they seem to be there so I don't understand what is going wrong:

mediapipe_simple_subgraph(
    name = "face_geometry_from_detection",
    graph = "face_geometry_from_detection.pbtxt",
    register_as = "FaceGeometryFromDetection",
    deps = [
        ":geometry_pipeline_calculator",
        "//mediapipe/calculators/core:begin_loop_calculator",
        "//mediapipe/calculators/core:end_loop_calculator",
        "//mediapipe/calculators/util:detection_to_landmarks_calculator",
    ],
)

mediapipe_simple_subgraph(
    name = "face_geometry_from_landmarks",
    graph = "face_geometry_from_landmarks.pbtxt",
    register_as = "FaceGeometryFromLandmarks",
    deps = [
        ":geometry_pipeline_calculator",
    ],
)

Provide the exact sequence of commands / steps that you executed before running into the problem:

Graphs compilation:

Copied the binary graphs to the library resources inside the virtual env site-packages and tried to call that from Python:

import mediapipe as mp

graph = mp.CalculatorGraph(
    binary_graph_path='/***/.virtualenvs/mediapipe/lib/python3.7/site-packages/mediapipe/modules/face_geometry/face_geometry_from_detection.binarypb')

graph = mp.CalculatorGraph(
    binary_graph_path='/***/.virtualenvs/mediapipe/lib/python3.7/site-packages/mediapipe/modules/face_geometry/face_geometry_from_landmarks.binarypb')

Complete Logs: Include Complete Log information or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached:

sgowroji commented 3 years ago

Duplicate https://github.com/google/mediapipe/issues/1578

RafaelMiquelino commented 3 years ago

Indeed. The related solution worked. Thanks!

google-ml-butler[bot] commented 3 years ago

Are you satisfied with the resolution of your issue? Yes No