2019年12月11日 星期三

Installing Darknet on Windows 7 (GPU)

Environment

  • OS: Windows 7 Professional
  • Processor: Intel Xeon CPU
  • System type: 64 bits OS
  • GPU: NVIDIA GeForce GTX 750 Ti. Intel GPU does not support CUDA so you can only use the CPU mode
  • Project Folder: darknet

Setup

Install cmake

  1. download cmake-3.16.0-win64-x64.msi from https://cmake.org/download/
  2. install cmake-3.16.0-win64-x64.msi
  3. select the option **Add CMake to the system PATH for the current user

Install Anaconda

Download and install Anaconda from https://www.anaconda.com/download/#windows

Install Git for Windows

  1. Download Git-2.19.0-64-bit.exe
  2. Install git
  3. Select the option Use Git from the windows command prompt

Install CUDA

  1. Open console. Change directory to C:\Program Files\NVIDIA Corporation\NVSMI.
  2. You can find the driver version by executing commnad nvidia-smi.exe.
  3. Reference CUDA Toolkit and Compatible Driver Versions table. My driver can use CUDA 9.1.
  4. Download CUDA Toolkit Archive
  5. Install cuda_9.1.85_windows_network.exe

Install OpenCV

  1. Download opencv
  2. Execute opencv-4.1.2-vc14_vc15.exe to extract this archive

Install cuDNN

  1. Login NVIDIA download.
  2. Download cuDNN v7.1.3 (April 17, 2018), for CUDA 9.1
  3. Extracting archive cudnn-9.1-windows7-x64-v7.1.zip
  4. Copy \cuda\bin\cudnn64_7.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin
  5. Copy \cuda\ include\cudnn.h to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include
  6. Copy \cuda\lib\x64\cudnn.lib to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\lib\x64

Build darknet project

install 140 build tool

  1. find visual studio installer and open it
  2. click modify button to modify your visual studio community 2017
  3. choose individual component table
  4. check desktop VC++ 2015.3 v14.00(v140) build tool in compiler , build tool an execute process section.
  5. click modify button to install it.

Build darknet.exe Steps

  1. git clone https://github.com/AlexeyAB/darknet.git
  2. edit file darknet\build\darknet\darknet.vcxproj
  3. modify CUDA 10.0.props as CUDA 9.1.props
  4. modify CUDA 10.0.targets as CUDA 9.1.targets
  5. copy C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\extras\visual_studio_integration\MSBuildExtensions*.* to C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140 and C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140\BuildCustomizations
  6. open the project file darknet\build\darknet\darknet.sln in Microsoft visual studio community 2017
  7. change config as Release and platform as x64
  8. open the property page of darknet project.
  9. select general item at left tree list.
  10. choose platform tool kit as Visual studio 2015(v140).
  11. select VC++ Directory item at left tree list.
  12. Choose include directory property. Edit directory.
  13. Add new directory D:\Adrian\Software\opencv\build\include D:\Adrian\Software\opencv\build\include\opencv2 D:\Adrian\Software\cudnn-9.1-windows7-x64-v7.1\cuda\include
  14. Choose library directory property. Edit directory.
  15. Add new directory D:\Adrian\Software\opencv\build\x64\vc14\lib D:\Adrian\Software\cudnn-9.1-windows7-x64-v7.1\cuda\lib\x64
  16. Select Linker| input item at left tree list.
  17. Choose other dependency property. Edit it.
  18. Add string opencv_world412.lib into the textarea.
  19. Select CUDA C/C++| Common item at left tree list.
  20. Choose CUDA Toolkit Custom Dir property. Edit it.
  21. Add directory C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1
  22. Select CUDA C/C++| Device item at left tree list.
  23. Choose Code Generation property. Remove ;compute_75,sm_75
  24. Build the project.
  25. Change directory to darknet\build\darknet\x64
  26. Download yolov3.weights and place it to darknet\build\darknet\x64
  27. Execute command darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg

Build yolo_cpp_dll steps

  1. Modify cuda version as your cuda version in darknet\build\darknet\yolo_cpp_dll.vcxproj
  2. Open yolo_cpp_dll.sln
  3. Follow Build darknet.exe Steps to build a yolo_cpp_dll.dll
  4. Execute command darknet\build\darknet\x64\python darknet.py to test it

Uninstall CUDA

  • uninstall NVIDIA Nsight Visual Studio Edition
  • uninstall NVIDIA CUDA Visual Studio Integration
  • uninstall NVIDIA CUDA Samples
  • uninstall NVIDIA CUDA Runtime
  • uninstall NVIDIA CUDA Documentation
  • uninstall NVIDIA CUDA Development

Error

Reference


如果你覺得這篇文章很有用,可以請我喝杯咖啡,讓我提供更多優質文章給您。感謝所有支持的朋友。

Vere Perrot 資訊人.科技人.行銷人,現為軟體分析師。定位自己為網路觀察家,永遠保持好奇心與熱情,學習跨領域新事物,希望最終能成為一個全方位的人。 Mail: vereperrot@gmail.com

沒有留言: