반응형

Ubuntu 20.04에 MediaPipe를 설치하여 간단한 예제를 실행시켜 보는 과정을 다루고 있습니다. 

Ubuntu 18.04도 같은 방식으로 진행하면 됩니다. 



MediaPipe가 무엇인지 궁금하시면 다음 두  링크를 방문해보세요..

 

https://github.com/google/mediapipe

 

https://google.github.io/mediapipe/ 



다음과 같은 것들을 할 수 있다고 합니다. . 이제 겨우  설치만 해봐서 이후 단계는 물어보셔도 아직 모릅니다 ^^;

Android, PC, Google Coral, Web을 위한 예제가 준비되어 있습니다.



Face Detection 

Multi-hand Tracking

Hand Tracking 

Hair Segmentation 

Object Detection

Object Detection and Tracking

Objectron: 3D Object Detection and Tracking

AutoFlip




최초작성 2020. 3. 29

              2020. 4. 2    hand tracking 예제 실행방법 추가 

              2020. 5. 8    bazel 2.0으로 변경된 점 반영

              2020. 11. 30 Ubuntu 20.04에서 진행 

              2021. 7. 15  Ubuntu 20.04에서 진행 

                                  Bazel 3.7.2로 변경

                                  opencv_linux.BUILD에서 절대경로 대신 상대 경로로 변경




0. 진행하기전에 우분투의 패키지를 업그레이드 해주었습니다. 반드시 해주세요.

꼭 해줘야 하는 작업은 아닌듯하지만 저는 습관적으로 해주는 편입니다. 

 

webnautes@webnautes-PC:~$ sudo apt-get update

webnautes@webnautes-PC:~$ sudo apt-get upgrade




1. 깃허브에서 MediaPipe를 다운로드합니다. 

 

webnautes@webnautes-PC:~$ pwd

/home/webnautes



webnautes@webnautes-PC:~$ git clone https://github.com/google/mediapipe.git




2. Bazel을 설치합니다. 2.x 버전은 아직 지원하지 않기 때문에  1.0.0 ~ 1.2.1 사이의 버전을 설치해야 한다고 합니다. 

   2.0 이상의 버전을  3.4 3.7.2 버전을 설치하는 것으로 변경되었습니다.  

 

2-1. 우선 C++ 컴파일러와  unzip, zip를 설치합니다. 이미 설치가 되있을 수도 있습니다. 

webnautes@webnautes-PC:~$ sudo apt install g++ unzip zip




2-2. jdk를 설치합니다. 

Ubuntu 16.04라면 OpenJDK 8을 설치하고 Ubuntu 18.04라면 OpenJDK 11을 설치합니다. 

 

sudo apt-get install openjdk-8-jdk

sudo apt-get install openjdk-11-jdk



Ubuntu 20.04를 사용중이라 OpenJDK 11을 설치했습니다. 

webnautes@webnautes-PC:~$ sudo apt-get install openjdk-11-jdk




2-3. bazel 3.4 설치 파일을 다운로드 받아 설치를 진행합니다.

 

webnautes@webnautes-PC:~$ wget https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel-3.7.2-installer-linux-x86_64.sh

 

webnautes@webnautes-PC:~$ chmod +x bazel-3.7.2-installer-linux-x86_64.sh

 

webnautes@webnautes-PC:~$ ./bazel-3.7.2-installer-linux-x86_64.sh  --user




2-4. ~/.bashrc 파일 끝에 다음처럼 경로를 추가해줍니다. 

export PATH="$PATH:$HOME/bin"

 

편집기를 열어 경로를 추가하고 환경에 반영해줍니다. 

webnautes@webnautes-PC:~$ nano ~/.bashrc 

webnautes@webnautes-PC:~$ source ~/.bashrc




3-1.  다음 포스트를 참고하여 OpenCV를 설치합니다.

 

Ubuntu 18.04에 OpenCV 4.2.0 설치하는 방법

https://webnautes.tistory.com/1186 

 

Ubuntu 20.04에 OpenCV 4.4.0 설치하는 방법

https://webnautes.tistory.com/1433 



FFmpeg를 설치합니다.

$ sudo apt install ffmpeg 



3-2. 깃허브에서 다운로드 받았던 mediapipe 디렉토리로 이동하여 

 

webnautes@webnautes-PC:~$ cd mediapipe

 

webnautes@webnautes-PC:~/mediapipe$ pwd

/home/webnautes/mediapipe




WORKSPACE 파일에서 다음 부분을 찾아 수정합니다. 

여기에서 라이브러리가 있는 루트 디렉토리를 지정하고 아래 cc_library에서 나머지 경로를 지정합니다. 

FFmpeg는 테스트 동작을 못해봤습니다.

 

webnautes@webnautesPC:~/mediapipe$ nano WORKSPACE

 

new_local_repository(

    name = "linux_opencv",

    build_file = "@//third_party:opencv_linux.BUILD",

    path = "/usr/local",

)

 

new_local_repository(

    name = "linux_ffmpeg",

    build_file = "@//third_party:ffmpeg_linux.BUILD",

    path = "/usr",

)



opencv_linux.BUILD 파일을 수정합니다. 

현재 디렉토리를 기준으로 다음 위치에 있습니다.

 

webnautes@webnautes-PC:~/mediapipe$ find . | grep opencv_linux.BUILD

./third_party/opencv_linux.BUILD



webnautes@webnautesPC:~/mediapipe$ nano ./third_party/opencv_linux.BUILD  



cc_library(

    name = "opencv",

    srcs = glob(

        [

            "lib/libopencv_core.so",

            "lib/libopencv_highgui.so",

            "lib/libopencv_imgcodecs.so",

            "lib/libopencv_imgproc.so",

            "lib/libopencv_video.so",

            "lib/libopencv_videoio.so",

        ],

    ),

    hdrs = glob([

        "include/opencv4/opencv2/**/*.h*",

    ]),

    includes = [

        "include/opencv4/",

    ],

    linkstatic = 1,

    visibility = ["//visibility:public"],

)

 

ffmpeg_linux.BUILD파일을 수정합니다. 

현재 디렉토리를 기준으로 다음 위치에 있습니다.

아직 테스트 해보지 않은 부분이라 동작시키려면 수정이 필요할 수 있습니다. 

 

webnautes@webnautes-PC:~/mediapipe$ find . | grep ffmpeg_linux.BUILD

./third_party/ffmpeg_linux.BUILD

 

webnautes@webnautesPC:~/mediapipe$ nano ./third_party/ffmpeg_linux.BUILD 

 

cc_library(

    name = "libffmpeg",

    srcs = glob(

        [

            "lib/x86_64-linux-gnu/libav*.so",

        ],

    ),

    hdrs = glob(["include/x86_64-linux-gnu/libav*/*.h"]),

    includes = ["include"],

    linkopts = [

        "-lavcodec",

        "-lavformat",

        "-lavutil",

    ],

    linkstatic = 1,

    visibility = ["//visibility:public"],

)




4. GPU 가속 관련 옵션 변경은 다음 링크의 4번을 참고하세요.

https://google.github.io/mediapipe/getting_started/install.html#installing-on-debian-and-ubuntu 

 

skip 합니다.




5. Hello World 예제를 실행시켜 봅니다. 

 

webnautes@webnautes-PC:~/mediapipe$ export GLOG_logtostderr=1



CPU만 사용해보았습니다.

webnautes@webnautes-PC:~/mediapipe$ bazel run --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hello_world:hello_world



GPU를 사용하려면 다음 링크의 5번을 참고하세요. 

https://google.github.io/mediapipe/getting_started/install.html#installing-on-debian-and-ubuntu 



잠시 기다리면 다음과 같은 결과를 볼 수 있습니다. 

처음 실행시에만 다운로드 및 빌드(?) 작업을 해서 시간이 걸리고 그 다음부턴 바로 실행이 됩니다. 

 

INFO: Analyzed target //mediapipe/examples/desktop/hello_world:hello_world (0 packages loaded, 0 targets configured).

INFO: Found 1 target...

Target //mediapipe/examples/desktop/hello_world:hello_world up-to-date:

  bazel-bin/mediapipe/examples/desktop/hello_world/hello_world

INFO: Elapsed time: 0.143s, Critical Path: 0.00s

INFO: 0 processes.

INFO: Build completed successfully, 1 total action

INFO: Running command line: bazel-bin/mediapipe/examples/desktop/hello_world/helINFO: Build completed successfully, 1 total action

I20201130 23:07:45.202827 26521 hello_world.cc:56] Hello World!

I20201130 23:07:45.202886 26521 hello_world.cc:56] Hello World!

I20201130 23:07:45.202899 26521 hello_world.cc:56] Hello World!

I20201130 23:07:45.202908 26521 hello_world.cc:56] Hello World!

I20201130 23:07:45.202956 26521 hello_world.cc:56] Hello World!

I20201130 23:07:45.202993 26521 hello_world.cc:56] Hello World!

I20201130 23:07:45.203039 26521 hello_world.cc:56] Hello World!

I20201130 23:07:45.203091 26521 hello_world.cc:56] Hello World!

I20201130 23:07:45.203135 26521 hello_world.cc:56] Hello World!

I20201130 23:07:45.203176 26521 hello_world.cc:56] Hello World!





6. 핸드 트래킹 예제를 컴파일하여 실행시켜봅니다. 

 

webnautes@webnautes-PC:~$ cd mediapipe/

 

webnautes@webnautes-PC:~/mediapipe$ pwd

/home/webnautes/mediapipe

 

webnautes@webnautes-PC:~/mediapipe$ bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu

 

webnautes@webnautes-PC:~/mediapipe$ GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_cpu --calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_desktop_live.pbtxt




조명이 어두운 편인데도 손이 잘 인식이 되네요.

이제 어떤 방식으로 MediaPipe를 사용하는지 살펴봐야 겠습니다. 

 

2020. 11. 30 아래 스크린샷에 비해 개선된 결과를 보여줍니다. 오른손 왼손을 구별하고 손가락 스켈레톤을 더 정확히 보여주는 듯합니다. 

아쉽게도 스크린샷은 추후 업데이트시 올리도록 하겠습니다. 

 



 

 

관련 포스트

 

Mediapipe의 Hello_World 예제 사용 방법

https://webnautes.tistory.com/1501

 

 

 

참고

https://google.github.io/mediapipe/getting_started/install.html#installing-on-debian-and-ubuntu 

https://docs.bazel.build/versions/master/install-ubuntu.html 







반응형

해본 것을 문서화하여 기록합니다.
부족함이 있지만 도움이 되었으면 합니다.


포스트 작성시에는 문제 없었지만 이후 문제가 생길 수 있습니다.
질문을 남겨주면 가능한 빨리 답변드립니다.


제가 쓴 책도 한번 검토해보세요 ^^

  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기

댓글을 달아 주세요

">
  1. thumbnail
    brothersoo
    2020.04.16 17:50

    안녕하세요, 좋은 글 감사드립니다.

    차근차근 한단계씩 따라해 보았는데 마지막 hand tracking 예제를 실행하는 단계에서 문제가 생겼습니다.

    webnautes@webnautes-PC:~/mediapipe$ GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_cpu --calculator_graph_config_file=mediapipe/graphs/hand_tracking/hand_tracking_desktop_live.pbtxt

    위 코드를 실행시켰을 때 마지막에

    I0416 17:26:34.940616 15692 demo_run_graph_main.cc:53] Initialize the calculator graph.
    I0416 17:26:34.948133 15692 demo_run_graph_main.cc:57] Initialize the camera or load the video.
    [ WARN:0] global /home/brothersoo/opencv/opencv-4.2.0/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
    [ WARN:0] global /home/brothersoo/opencv/opencv-4.2.0/modules/videoio/src/cap_v4l.cpp (887) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
    E0416 17:26:34.963476 15692 demo_run_graph_main.cc:146] Failed to run the graph: ; capture.isOpened()(mediapipe/examples/desktop/demo_run_graph_main.cc:65)

    이러한 코드가 뜨면서 실패를 하네요.
    검색을 해보니 이런저런 버전 차이때문에 그런거라는데 정확히 왜 그런지는 잘 모르겠습니다.

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.04.16 18:02 신고

      웹캠을 연결하고 하셨나요?

    • thumbnail
      brothersoo
      2020.04.16 18:31

      넵 웹캠이 있는 노트북으로 테스트 해보았고 웹캠을 따로 실행시에는 잘 작동했습니다. 다른 파이썬 예제를 테스트할 때에는 웹캠이 잘 작동했었습니다.

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.04.16 18:38 신고

      에러상으론 카메라를 열지 못한다네요.

  2. thumbnail
    pooso95
    2020.05.01 21:16

    안녕하세요. 이해하기 쉽게 글을 써 주셔서 천천히 따라하기 좋았습니다.

    마지막에 hello_world를 실행시키는데 오류가 발생했는데
    무슨 오류인지 정확한 원인을 잘 모르겠습니다ㅜㅜ

    조언을 구할 수 있을까요?

    <오류코드>
    ERROR: /home/user1/mediapipe/mediapipe/framework/deps/BUILD:194:1: C++ compilation of rule '//mediapipe/framework/deps:registration_token' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 25 argument(s) skipped)

    Use --sandbox_debug to see verbose messages from the sandbox
    gcc: error: unrecognized command line option '-std=c++14'
    Target //mediapipe/examples/desktop/hello_world:hello_world failed to build
    Use --verbose_failures to see the command lines of failed build steps.
    INFO: Elapsed time: 0.283s, Critical Path: 0.06s
    INFO: 0 processes.
    FAILED: Build did NOT complete successfully
    FAILED: Build did NOT complete successfully

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.05.01 21:23 신고

      사용하는 리눅스에 설치된 g++ 컴파일러가 c++14를 지원하지 못해서 발생한 에러로 보입니다. 전 우분투 18.04에서 테스트를 진행했습니다.

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.05.01 23:34 신고

      bazel clean하고 다시해보세요

  3. thumbnail
    wizwiz
    2020.05.07 16:17

    안녕하세요, 좋은 글 감사드립니다.
    따라 하다가 hello_world 예제 실행 부분에서 오류가 발생하였습니다 ㅠㅠ
    혹시 가능 하시다면 도움 부탁드립니다 ㅠ

    bazel run --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hello_world:hello_world

    Starting local Bazel server and connecting to it...
    INFO: Options provided by the client:
    Inherited 'common' options: --isatty=1 --terminal_columns=80
    INFO: Reading rc options for 'run' from /home/wizner/mediapipe/.bazelrc:
    Inherited 'build' options: --jobs 128 --define=absl=1 --cxxopt=-std=c++14 --copt=-Wno-sign-compare --copt=-Wno-unused-function --copt=-Wno-uninitialized --copt=-Wno-unused-result --copt=-Wno-comment --copt=-Wno-return-type --copt=-Wno-unused-local-typedefs --copt=-Wno-ignored-attributes --experimental_repo_remote_exec --apple_platform_type=macos --apple_generate_dsym
    ERROR: Unrecognized option: --experimental_repo_remote_exec

  4. thumbnail
    Kuha
    2020.05.20 18:10

    Hello World 까지는 잘되었는데
    손트래킹을 빌드할때

    ERROR: /home/kds/mediapipe/mediapipe/examples/desktop/hand_tracking/BUILD:27:1: Linking of rule '//mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc @bazel-out/k8-opt/bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_cpu-2.params

    와 같은 에러를 내뿜내요... 혹시 어떤것때문인지 도움을 주셨으면 합니다!

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.05.20 20:24 신고

      에러 내용이 안보입니다. 확인후 다시 올려주세요

    • thumbnail
      Kuha
      2020.05.20 21:19

      잘못올렸네요 다시 올립니다!

      kds@kds-VirtualBox:~/mediapipe$ bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu
      INFO: Analyzed target //mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu (0 packages loaded, 0 targets configured).
      INFO: Found 1 target...
      ERROR: /home/kds/mediapipe/mediapipe/examples/desktop/hand_tracking/BUILD:27:1: Linking of rule '//mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu' failed (Exit 1) gcc failed: error executing command /usr/bin/gcc @bazel-out/k8-opt/bin/mediapipe/examples/desktop/hand_tracking/hand_tracking_cpu-2.params

      Use --sandbox_debug to see verbose messages from the sandbox
      bazel-out/k8-opt/bin/mediapipe/examples/desktop/_objs/demo_run_graph_main/demo_run_graph_main.o:demo_run_graph_main.cc:function RunMPPGraph(): error: undefined reference to 'cv::namedWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
      bazel-out/k8-opt/bin/mediapipe/examples/desktop/_objs/demo_run_graph_main/demo_run_graph_main.o:demo_run_graph_main.cc:function RunMPPGraph(): error: undefined reference to 'cv::VideoCapture::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
      bazel-out/k8-opt/bin/mediapipe/examples/desktop/_objs/demo_run_graph_main/demo_run_graph_main.o:demo_run_graph_main.cc:function RunMPPGraph(): error: undefined reference to 'cv::VideoWriter::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, double, cv::Size_<int>, bool)'
      bazel-out/k8-opt/bin/mediapipe/examples/desktop/_objs/demo_run_graph_main/demo_run_graph_main.o:demo_run_graph_main.cc:function RunMPPGraph(): error: undefined reference to 'cv::VideoWriter::write(cv::_InputArray const&)'
      bazel-out/k8-opt/bin/mediapipe/examples/desktop/_objs/demo_run_graph_main/demo_run_graph_main.o:demo_run_graph_main.cc:function RunMPPGraph(): error: undefined reference to 'cv::imshow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)'
      bazel-out/k8-opt/bin/mediapipe/calculators/video/_objs/opencv_video_decoder_calculator/opencv_video_decoder_calculator.o:opencv_video_decoder_calculator.cc:function mediapipe::OpenCvVideoDecoderCalculator::Open(mediapipe::CalculatorContext*): error: undefined reference to 'cv::VideoCapture::VideoCapture(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
      bazel-out/k8-opt/bin/mediapipe/calculators/video/_objs/opencv_video_encoder_calculator/opencv_video_encoder_calculator.o:opencv_video_encoder_calculator.cc:function mediapipe::OpenCvVideoEncoderCalculator::SetUpVideoWriter(float, int, int): error: undefined reference to 'cv::VideoWriter::VideoWriter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, double, cv::Size_<int>, bool)'
      bazel-out/k8-opt/bin/mediapipe/calculators/image/_objs/image_cropping_calculator/image_cropping_calculator.o:image_cropping_calculator.cc:function mediapipe::ImageCroppingCalculator::RenderCpu(mediapipe::CalculatorContext*): error: undefined reference to 'cv::getPerspectiveTransform(cv::_InputArray const&, cv::_InputArray const&, int)'
      bazel-out/k8-opt/bin/mediapipe/calculators/image/_objs/image_transformation_calculator/image_transformation_calculator.o:image_transformation_calculator.cc:function mediapipe::ImageTransformationCalculator::RenderCpu(mediapipe::CalculatorContext*): error: undefined reference to 'cv::getRotationMatrix2D_(cv::Point_<float>, double, double)'
      bazel-out/k8-opt/bin/mediapipe/util/_objs/annotation_renderer/annotation_renderer.o:annotation_renderer.cc:function mediapipe::AnnotationRenderer::DrawRectangle(mediapipe::RenderAnnotation const&): error: undefined reference to 'cv::rectangle(cv::_InputOutputArray const&, cv::Rect_<int>, cv::Scalar_<double> const&, int, int, int)'
      bazel-out/k8-opt/bin/mediapipe/util/_objs/annotation_renderer/annotation_renderer.o:annotation_renderer.cc:function mediapipe::AnnotationRenderer::DrawFilledRectangle(mediapipe::RenderAnnotation const&): error: undefined reference to 'cv::fillConvexPoly(cv::_InputOutputArray const&, cv::Point_<int> const*, int, cv::Scalar_<double> const&, int, int)'
      bazel-out/k8-opt/bin/mediapipe/util/_objs/annotation_renderer/annotation_renderer.o:annotation_renderer.cc:function mediapipe::AnnotationRenderer::DrawFilledRectangle(mediapipe::RenderAnnotation const&): error: undefined reference to 'cv::rectangle(cv::_InputOutputArray const&, cv::Rect_<int>, cv::Scalar_<double> const&, int, int, int)'
      bazel-out/k8-opt/bin/mediapipe/util/_objs/annotation_renderer/annotation_renderer.o:annotation_renderer.cc:function mediapipe::AnnotationRenderer::DrawGradientLine(mediapipe::RenderAnnotation const&): error: undefined reference to 'cv::rectangle(cv::_InputOutputArray const&, cv::Rect_<int>, cv::Scalar_<double> const&, int, int, int)'
      bazel-out/k8-opt/bin/mediapipe/util/_objs/annotation_renderer/annotation_renderer.o:annotation_renderer.cc:function mediapipe::AnnotationRenderer::DrawText(mediapipe::RenderAnnotation const&): error: undefined reference to 'cv::putText(cv::_InputOutputArray const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)'
      collect2: error: ld returned 1 exit status
      Target //mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu failed to build
      Use --verbose_failures to see the command lines of failed build steps.
      INFO: Elapsed time: 1.213s, Critical Path: 0.64s
      INFO: 0 processes.
      FAILED: Build did NOT complete successfully

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.05.20 22:56 신고

      opencv를 설치했나요? 못찾는 에러가 났네요

    • thumbnail
      Kuha
      2020.05.21 00:24

      네 페이스디텍트 예제는 작동하는걸 확인했습니다.

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.05.21 00:32 신고

      포스트한대로 따라하면 동작해야 하는데 이상하군요.. opencv 라이브러리를 못찾는 에러가 났습니다.

      find . | grep libopencv로 라이브러리 위치를 찾은후 다음처럼 라이브러리 경로를 설정해서 다시 해보세요

      export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/custom/path/

  5. thumbnail
    wonjongbot
    2020.06.26 16:11

    안녕하세요, hello 예제를 열면 에러가 나오네요. 무엇이 문제일까요? 감사합니다!
    /works/mediapipe/mediapipe$ bazel run --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hello_world:hello_world
    INFO: Call stack for the definition of repository 'local_execution_config_python' which is a local_python_configure (rule definition at /home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/py/python_configure.bzl:275:26):
    - /home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/toolchains/remote_config/rbe_config.bzl:158:5
    - /home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/toolchains/remote_config/configs.bzl:6:5
    - /home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/tensorflow/workspace.bzl:93:5
    - /home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/tensorflow/workspace.bzl:77:5
    - /works/mediapipe/mediapipe/WORKSPACE:337:1
    ERROR: An error occurred during the fetch of repository 'local_execution_config_python':
    Traceback (most recent call last):
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/py/python_configure.bzl", line 208
    get_python_bin(repository_ctx)
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/remote_config/common.bzl", line 44, in get_python_bin
    which(repository_ctx, "python")
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/remote_config/common.bzl", line 29, in which
    execute(repository_ctx, <1 more arguments>)
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/remote_config/common.bzl", line 208, in execute
    fail(<1 more arguments>)
    Repository command failed

    INFO: Call stack for the definition of repository 'rules_java' which is a http_archive (rule definition at /home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/bazel_tools/tools/build_defs/repo/http.bzl:292:16):
    - /home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/bazel_tools/tools/build_defs/repo/utils.bzl:205:9
    - /DEFAULT.WORKSPACE.SUFFIX:290:1
    ERROR: While resolving toolchains for target //mediapipe/examples/desktop/hello_world:hello_world: invalid registered toolchain '@local_execution_config_python//:py_toolchain': no such package '@local_execution_config_python//': Traceback (most recent call last):
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/py/python_configure.bzl", line 208
    get_python_bin(repository_ctx)
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/remote_config/common.bzl", line 44, in get_python_bin
    which(repository_ctx, "python")
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/remote_config/common.bzl", line 29, in which
    execute(repository_ctx, <1 more arguments>)
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/remote_config/common.bzl", line 208, in execute
    fail(<1 more arguments>)
    Repository command failed

    ERROR: Analysis of target '//mediapipe/examples/desktop/hello_world:hello_world' failed; build aborted: invalid registered toolchain '@local_execution_config_python//:py_toolchain': no such package '@local_execution_config_python//': Traceback (most recent call last):
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/py/python_configure.bzl", line 208
    get_python_bin(repository_ctx)
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/remote_config/common.bzl", line 44, in get_python_bin
    which(repository_ctx, "python")
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/remote_config/common.bzl", line 29, in which
    execute(repository_ctx, <1 more arguments>)
    File "/home/frontis/.cache/bazel/_bazel_frontis/dc9843482fbedda2bc26c0230f8ac174/external/org_tensorflow/third_party/remote_config/common.bzl", line 208, in execute
    fail(<1 more arguments>)
    Repository command failed

    INFO: Elapsed time: 0.350s
    INFO: 0 processes.
    FAILED: Build did NOT complete successfully (10 packages loaded, 11 targets configured)
    FAILED: Build did NOT complete successfully (10 packages loaded, 11 targets configured)
    currently loading: @bazel_tools//tools/jdk

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.06.26 21:53 신고

      버전업 되면서 바뀐점이 또 발생한 듯합니다.

      아래 링크를 참고하여 진행해보세요

      https://google.github.io/mediapipe/getting_started/install.html

  6. thumbnail
    Favicon of https://go-ming.tistory.com BlogIcon 고개발

    안녕하세요. 모두 똑같이 따라갔는데 hello world 출력 과정에서 다음과같은 문제가 생겼습니다 ㅠㅠ
    bazel run --define MEDIAPIPE_IDSABLE_GPU=1 mediapipe/examples/desktop/hello_world:hello_world

    DEBUG: /home/money/.cache/bazel/_bazel_money/f8fa67832b324a524cf2546304b89b98/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:103:9: rbe_ubuntu1804_java11 not using checked in configs as detect_java_home was set to True
    DEBUG: /home/money/.cache/bazel/_bazel_money/f8fa67832b324a524cf2546304b89b98/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:103:9: rbe_ubuntu1604_java8 not using checked in configs as detect_java_home was set to True
    INFO: Build option --define has changed, discarding analysis cache.
    ERROR: Analysis of target '//mediapipe/examples/desktop/hello_world:hello_world' failed; build aborted: invalid registered execution platform '//:default_host_platform': no such target '//:default_host_platform': target 'default_host_platform' not declared in package '' defined by /home/money/mediapipe/BUILD.bazel
    INFO: Elapsed time: 0.149s
    INFO: 0 processes.
    FAILED: Build did NOT complete successfully (0 packages loaded, 6 targets con\
    FAILED: Build did NOT complete successfully (0 packages loaded, 6 targets con\
    figured)

    정말 열심히 알아봤는데도 답을 모르겠네요.... 뭐가 문제일까요? 혹시 도와주실수있다면 정말 감사할것 같아요..

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.11.30 16:39 신고

      java8과 java11을 둘다 설치했나요? 로그에 둘다 보이네요.. 사용하는 우분투 버전이 어떻게 되나요?

    • thumbnail
      Favicon of https://go-ming.tistory.com BlogIcon 고개발
      2020.11.30 17:15 신고

      아.. 네 ㅠㅠ java8을 설치했는데 안돼서 java11을 깔아야하는게 문제인가.. 해서 둘다 깔았습니다.
      ubuntu 18.04에요!

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.11.30 17:32 신고

      진행한 방법이 바뀌었을 수 있습니다. 참고한 사이트에서 확인해보세요.

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.11.30 17:33 신고

      링크가 바뀌었네요.. 확인해볼께요

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2020.11.30 23:32 신고

      진행 방법이 많이 바뀌었네요. 수정해놓았으니 진행해보세요.

    • thumbnail
      Favicon of https://go-ming.tistory.com BlogIcon 고개발
      2021.01.10 22:57 신고

      안녕하세요^^.. 한달뒤에 다시 해보고 있는데 이번엔 바젤 3.4.0으로 업데이트했더니 이런 문제가 발생합니다..
      우분투 18.04/바젤 3.4.0/오픈cv 3.4.0입니다 ㅎㅎ..

      money@moneymany:~/mediapipe$ bazel run --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hello_world:hello_world
      ERROR: /home/money/.cache/bazel/_bazel_money/f8fa67832b324a524cf2546304b89b98/external/org_tensorflow/third_party/gpus/cuda_configure.bzl:1409:40: in call to repository_rule(), parameter 'remotable' is experimental and thus unavailable with the current flags. It may be enabled by setting --experimental_repo_remote_exec
      ERROR: in /home/money/.cache/bazel/_bazel_money/f8fa67832b324a524cf2546304b89b98/external/org_tensorflow/tensorflow/workspace.bzl: Extension file 'third_party/gpus/cuda_configure.bzl' has errors
      INFO: Elapsed time: 0.632s
      INFO: 0 processes.
      FAILED: Build did NOT complete successfully (0 packages loaded)
      FAILED: Build did NOT complete successfully (0 packages loaded)
      Fetching @io_bazel_rules_closure; fetching

      혹시 아시는 바 있으시면 알려주세요..!감사합니다..

  7. thumbnail
    Favicon of https://go-ming.tistory.com BlogIcon 고개발

    감사합니다! 다시 해볼게요

  8. thumbnail
    Favicon of https://habeen.tistory.com BlogIcon habeeninggu

    혹시 bazel 설치할때 exec 형식오류가 계속 뜨는데 해결방법 아시나요 ..?

    • thumbnail
      Favicon of https://webnautes.tistory.com BlogIcon webnautes
      2021.03.31 17:55 신고

      주기적으로 버전 업데이트시 하는 방법에 변동이 생기네요. 구글에서 에러 메시지를 찾아서 해결할수 밖에 없습니다.

  9. thumbnail
    Favicon of https://apwnak.tistory.com BlogIcon 녜주

    매번 좋은글 감사드립니다.

    제 경우 실행하면서 난 에러 3개를 정리해봅니다.

    1. hdrs = glob([
    Error in glob: pattern cannot be absolute
    => hrds 내의 경로를 절대경로가 아닌 상대경로로 변경

    2.
    mediapipe/calculators/tensor/image_to_tensor_converter_opencv.cc:106:12: error: could not convert 'tensor' from 'mediapipe::Tensor' to 'absl::lts_2020_09_23::StatusOr<mediapipe::Tensor>'
    return tensor;
    ^~~~~~
    Target //mediapipe/examples/desktop/hand_tracking:hand_tracking_cpu failed to build
    => gcc, g++이 구버전이었습니다. 9.4.0으로 둘다 업그레이드 하였습니다.
    (업그레이드 참조: https://gist.github.com/application2000/73fd6f4bf1be6600a2cf9f56315a2d91)

    3. this rule is missing dependency declarations for the following files included by 'com_google_protobuf/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc':
    '/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h'
    '/usr/lib/gcc/x86_64-linux-gnu/9/include/stdarg.h'
    '/usr/lib/gcc/x86_64-linux-gnu/9/include/stdint.h'
    '/usr/lib/gcc/x86_64-linux-gnu/9/include/limits.h'
    '/usr/lib/gcc/x86_64-linux-gnu/9/include/syslimits.h'

    => rm -rf /home/{user}/.cache/bazel/_bazel_{user}

    로 하니 드디어 빌드가 됐네요!
    블로그 항상 잘보고 있습니다.
    건승하세요!

  10. thumbnail
    2021.07.18 23:15

    비밀댓글입니다

  11. thumbnail
    2021.08.06 16:25

    비밀댓글입니다