Dlib 설치법 (파이썬용)

2021. 9. 9. 11:58전공공부/전자전기전공

C++ library다 보니 설치하기가 너무 빡셌다.... 

참고로 나의 pc는 윈도우, vscode에서 프로젝트에서 dlib을 사용하기 위해 설치했다.

 

1. 먼저 c++ compiler가 없으면 다운받는다.

 

https://visualstudio.microsoft.com/ko/thank-you-downloading-visual-studio/?sku=BuildTools 

 

Visual Studio를 다운로드해 주셔서 감사합니다. - Visual Studio

Visual Studio를 처음 사용하시나요? 새로운 개발 도구를 학습하는 것은 어려울 수 있습니다. 이 단계별 학습 여정을 통해 원하는 언어로 간단한 앱을 성공적으로 만들 수 있습니다. 시작하겠습니다

visualstudio.microsoft.com

 

2. cmake을 다운받는다.

http://cmake.org/download

 

Download | CMake

Current development distribution Each night binaries are created as part of the testing process. Other than passing all of the tests in CMake, this version of CMake should not be expected to work in a production environment. It is being produced so that us

cmake.org

 

3. pip install dlib은 죽어도 안된다. 

그러니 직접 라이브러리를 설치해서 풀어야한다.

http://dlib.net/

 

dlib C++ Library

Dlib is a modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ to solve real world problems. It is used in both industry and academia in a wide range of domains including robotics, embedded devices, mobil

dlib.net

dlib 다운

왼쪽 하단에 보면 저 파랑색 상자가 있다. 그것을 다운받고 c 드라이브에 압축을 푼다. 

 

 

4. 폴더 분류

폴더를 다음과 같이 생성하고, 나머지 파일은 다 source 안에 넣는다.

 

5. cmd 창으로 이동!

cd /
cd dlib-19.22 (cd가 파일 이동하는 명령어, 버전은 다운로드따라 달라지니 참고)
cd source 
python setup.py build
완료된 뒤
python setup.py install

6. 확인

python 창에

import dlib
print(dlib.__version__) 

잘 나오면 완료!

 

7. 다양한 라이브러리 다운 

 

나는 프로젝트 위해서 openface나 face_recognition 라이브러리 활용 

하지만 얼굴을 더 정확히 인식하는데 좋은 성능을 보이는 건 dlib 라이브러리에 있는 https://osdn.net/projects/sfnet_dclib/downloads/dlib/v18.10/shape_predictor_68_face_landmarks.dat.bz2/

 

Downloading File /dlib/v18.10/shape_predictor_68_face_landmarks.dat.bz2 - dlib C++ Library - OSDN

Free download page for Project dlib C++ Library's shape_predictor_68_face_landmarks.dat.bz2.Dlib is a C++ toolkit containing machine learning algorithms and tools that facilitate creating compl...

osdn.net

 

아까 언급한

 

https://github.com/ageitgey/face_recognition

 

GitHub - ageitgey/face_recognition: The world's simplest facial recognition api for Python and the command line

The world's simplest facial recognition api for Python and the command line - GitHub - ageitgey/face_recognition: The world's simplest facial recognition api for Python and the command line

github.com

https://github.com/cmusatyalab/openface

 

GitHub - cmusatyalab/openface: Face recognition with deep neural networks.

Face recognition with deep neural networks. Contribute to cmusatyalab/openface development by creating an account on GitHub.

github.com

참고하시고 2시간 동안 고통받는 일 없음 좋겠다.