본문 바로가기

프로젝트 기록

YOLO Object Detector 쓰기 (3)

컴파일 삽질 시작 - Darknet

본격적으로 Darknet을 Build해본다.

  1. Github에서 Darknet repo를 clone해온다.

     git clone https://github.com/AlexeyAB/darknet.git
  2. Opencv\build\bin\Release의 opencv_ffmpeg, opencv_world dll을 darknet\build\darknet\x64로 복사한다.

  3. Cuda Dir(CUDNN 복사한 dir)\bin 에서 cuDNN64_7.dll을 darknet\build\darknet\x64로 복사한다.

  4. darknet\build\darknet 의 darknet.vcxproj 을 text editor로 연다

    • CUDA_10으로 find 후 버전을 10.2로 전부 수정한다.
  5. darknet\build\darknet 의 yolo_cpp_dll.vcxproj 을 text editor로 연다

    • CUDA_10으로 find 후 버전을 10.2로 전부 수정한다.
  6. darknet\build\darknet 의 yolo_cpp_dll.vcxproj 을 Visual Studio로 연다

    • 위의 환경을 Relese, x64로 수정
    • Solution Explorer에서 yolo_cpp_dll 프로젝트 빌드
  7. darknet\build\darknet 의 darknet.sln 을 Visual Studio로 연다

    • 위의 환경을 Relese, x64로 수정
    • Solution Explorer에서 darknet 프로젝트 속성
      1. C/C++ → General → Additional Include Directories 수정
        • "opencv\build\install\include" 추가
      2. C/C++ → Preprocessor → Preprocessor Definitions 수정
        • "CUDNN_HALF" 삭제(RT core 없는 그래픽카드일 경우.)
      3. CUDA C/C++ → Device → Code Generation 수정
        • "compute_75,sm_75" 삭제
      4. Linker → General → Additional Library Directories 수정
        • "opencv\build\install\x64\vc16\lib" 추가
    • darknet 프로젝트 빌드
    • Done!

빌드 후 테스트

darknet\build\darknet\x64 에서, python 실행후 import darknet 하면 로드완료!

python에서 darknet 을 로드해서 사용해도 되고, darknet.exe 를 직접 실행해서 학습해도 된다!


ref

  1. https://github.com/AlexeyAB/darknet
  2. https://www.youtube.com/watch?v=5pYh1rFnNZs&feature=youtu.be
  3. https://github.com/opencv/opencv