개발/mediapipe

Windows 에서 media pipe 설치하기

내공얌냠 2022. 3. 1. 13:09

아래의 링크를 보고 따라합니다.

https://google.github.io/mediapipe/getting_started/install.html#installing-on-windows

 

Installation

Cross-platform, customizable ML solutions for live and streaming media.

google.github.io

1. MYSYS2 설치

먼저 mysys2 를 다운로드하여 설치하고 PATH 에 추가해줍니다.

여기서 지정해준 경로 내부 폴더로 PATH를 추가하게 됩니다.

PATH 추가

 

2. 필요한 패키지 설치

PATH를 저장한 후 새로운 cmd를 켜서 아래와 같이 입력합니다.

pacman -S git patch unzip

Y 를 입력해서 설치를 진행시킵니다.

3. python을 설치하고 PATH에 추가합니다.

https://www.python.org/downloads/

 

Download Python

The official home of the Python Programming Language

www.python.org

설치 시 하단에 체크 중에 Add Python 3.9 to PATH가 편리하게 있어서 체크 후 Install Now로 설치를 진행하였습니다.

4. Visual C++ Build Tool 2019 와 WinSDK를 설치합니다.

Visual C++ Build Tool 2019 -> 저는 visual studio 가 설치되어있어서 생략하였습니다.

https://visualstudio.microsoft.com/ko/visual-cpp-build-tools/

 

Microsoft C++ Build Tools - Visual Studio

Microsoft C++ Build Tools는 Visual Studio 없이 스크립트 가능한 독립 실행형 설치 관리자를 통해 MSVC 도구 집합을 제공합니다. 명령줄에서 Windows를 대상으로 하는 C++ 라이브러리 및 애플리케이션을 빌드

visualstudio.microsoft.com

WinSDK

https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/

 

Windows SDK - Windows app development

What's new The Windows SDK for Windows 11 lets you update your apps for the latest version of the Windows OS. Learn more about the new features in Windows 11. To see the new APIs introduced with Windows 11, see New APIs in Windows 11 build 22000. Rebuilt t

developer.microsoft.com

일단 다 체크 된 상태로 설치해봅니다. 3.3 GB 라니..;;;

5. Bazel 혹은 Bazelisk 를 설치하고 PATH에 Bazel 의 위치를 추가합니다

저는 Bazel 을 설치하겠습니다.

https://docs.bazel.build/versions/main/install-windows.html

 

Installing Bazel on Windows - Bazel main

Installing Bazel on Windows This page describes the requirements and steps to install Bazel on Windows. It also includes troubleshooting and other ways to install Bazel, such as using Chocolatey or Scoop. Installing Bazel This section covers the prerequisi

docs.bazel.build

미리 설치하는

Visual C++ Redistributable for Visual Studio 2015 이건 다른 버전으로 이미 설치가 되어있었기 때문에 저는 생략하였습니다.

https://github.com/bazelbuild/bazel/releases

 

Releases · bazelbuild/bazel

a fast, scalable, multi-language and extensible build system - bazelbuild/bazel

github.com

아래에서 원하는 버전으로 미러서버에서 다운로드 받습니다.

원하는 경로에 .exe 파일을 넣고 이름은 bazel.exe 로 변경 후 해당 경로를 (bazel.exe까지 포함안함 그 전단계까지..) PATH에 추가합니다.

bazel version 을 입력하면 아래와 같이 나오게 됩니다.

 

6. bazel 변수를 설정해줍니다.

set BAZEL_VS=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC
set BAZEL_VC_FULL_VERSION=<Your local VC version>
set BAZEL_WINSDK_FULL_VERSION=<Your local WinSDK version>

// 저는 아래와 같은 버전이었습니다!
set BAZEL_VC_FULL_VERSION=19.29.30136
set BAZEL_WINSDK_FULL_VERSION=10.0.19041.0

VC_FULL_VERSION 을 찾기위해선 컴퓨터 마다 다르지만

스택오버플로우를 참고하여 저는 여기서 cl.exe 를 실행시켜 확인할 수 있었습니다.

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64

WinSDK 버전

Visual studio installer 실행 후 우측에서 확인.

변수 설정

7. media pipe repository 를 clone 하고 받은 폴더의 루트 디렉토리로 경로를 변경합니다.

git clone https://github.com/google/mediapipe.git
cd mediapipe

8. opencv 설치

https://opencv.org/releases/

 

Releases - OpenCV

Become a Member Stay up to date on OpenCV and Computer Vision news Join our Newsletter  

opencv.org

저는 도큐먼트대로 3.4.10 으로 설치하였습니다.

https://sourceforge.net/projects/opencvlibrary/files/3.4.10/opencv-3.4.10-vc14_vc15.exe/download

다운로드 받아 실행시키면 압축이 해제되고, 해당 폴더를 c:\opencv 이렇게 되도록 위치시킵니다.

만약 다른 경로에 하고 싶다면 도큐먼트에서 말하는 WORKSPACE 파일 내부의 new local repository의 path 부분을 수정해주시면 됩니다.

9. 테스트

레포지토리 하위 WORKSPACE 파일이랑 같은 레벨에서 진행합니다.

bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 --action_env PYTHON_BIN_PATH="C:/Users/<사용자명>/AppData/Local/Programs/Python/Python39/python.exe" mediapipe/examples/desktop/hello_world

set GLOG_logtostderr=1

bazel-bin\mediapipe\examples\desktop\hello_world\hello_world.exe

 

 

 

 

 

 

 

 

 

 

References

https://google.github.io/mediapipe/getting_started/install.html#installing-on-windows

 

Installation

Cross-platform, customizable ML solutions for live and streaming media.

google.github.io

 

https://stackoverflow.com/questions/1233312/finding-version-of-microsoft-c-compiler-from-command-line-for-makefiles

 

Finding version of Microsoft C++ compiler from command-line (for makefiles)

I must be missing something really obvious, but for some reason, the command-line version of the Microsoft C++ compiler (cl.exe) does not seem to support reporting just its version when run. We need

stackoverflow.com

 

728x90
반응형