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.76k stars 5.18k forks source link

Integrate MediaPipe Hand landmarks with dlib #571

Closed 7AM7 closed 4 years ago

7AM7 commented 4 years ago

Hello there, How I can Integrate frame process in mediapipe with other libraries like dlib? I am trying to do that on IOS, Desktop and Android. My final output should be multi-hand landmarks and facial expressions landmarks points.

fenollp commented 4 years ago

You'll need to fetch dlib from WORKSPACE, for example:

http_archive(
    name = "dlib",
    build_file = "@//third_party:dlib.BUILD",
    sha256 = "11693b6b71d986bd6c06979f9c95e282e96b52d72455ed10a21c453f28003a30",
    type = "zip",
    url = "https://github.com/davisking/dlib/archive/v19.18.zip",
)

where third_party/dlib.BUILD is:

cc_library(
    name = "dlib",
    hdrs = glob(["dlib-*/dlib/**/*.h"]),
    linkstatic = 1,
    strip_include_prefix = glob(["dlib-*/.gitignore"])[0].split("/", 1)[0],
    visibility = ["//visibility:public"],
)

then write your own calculators wrapping dlib calls.

7AM7 commented 4 years ago

fetched but I cannot include it with this line #include <dlib/image_processing/frontal_face_detector.h> error mediapipe/calculators/util/face_landmarks_to_render_data_calculator.cc:32:10: fatal error: 'dlib/image_processing/frontal_face_detector.h' file not found

fenollp commented 4 years ago

Did you make sure that your calculator depends on dlib?

cc_library(
    name = "face_landmarks_to_render_data_calculator",
    ...
    deps = [
        ...
        "@dlib",
    ],
)
7AM7 commented 4 years ago

When I try to call frontal_face_detector detector = get_frontal_face_detector(); I got this error ld: symbol(s) not found for architecture arm64 @fenollp any help?

fenollp commented 4 years ago

This error means some object files (containing compiled functions or symbols) could not be found when linking objects together (last step of producing a binary executable). The missing symbols should be listed around where this error appears. Maybe you missed listing a dependency in a BUILD file? Could you share your code here?

7AM7 commented 4 years ago

I am trying with IOS and this is my BUILD file

cc_library(
    name = "face_landmarks_to_render_data_calculator",
    srcs = ["face_landmarks_to_render_data_calculator.cc"],
    visibility = ["//visibility:public"],
    deps = [
        "//mediapipe/framework:calculator_framework",
        "//mediapipe/framework:calculator_options_cc_proto",
        "//mediapipe/util:color_cc_proto",
        "//mediapipe/util:render_data_cc_proto",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/strings",
    "@dlib",
    ],
    alwayslink = 1,
)