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
- download cmake-3.16.0-win64-x64.msi from https://cmake.org/download/
- install cmake-3.16.0-win64-x64.msi
- 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
- Download Git-2.19.0-64-bit.exe
- Install git
- Select the option Use Git from the windows command prompt
Install CUDA
- Open console. Change directory to C:\Program Files\NVIDIA Corporation\NVSMI.
- You can find the driver version by executing commnad nvidia-smi.exe.
- Reference CUDA Toolkit and Compatible Driver Versions table. My driver can use CUDA 9.1.
- Download CUDA Toolkit Archive
- Install cuda_9.1.85_windows_network.exe
Install OpenCV
- Download opencv
- Execute opencv-4.1.2-vc14_vc15.exe to extract this archive
Install cuDNN
- Login NVIDIA download.
- Download cuDNN v7.1.3 (April 17, 2018), for CUDA 9.1
- Extracting archive cudnn-9.1-windows7-x64-v7.1.zip
- Copy \cuda\bin\cudnn64_7.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin
- Copy \cuda\ include\cudnn.h to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include
- 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
- find visual studio installer and open it
- click modify button to modify your visual studio community 2017
- choose individual component table
- check desktop VC++ 2015.3 v14.00(v140) build tool in compiler , build tool an execute process section.
- click modify button to install it.
Build darknet.exe Steps
- git clone https://github.com/AlexeyAB/darknet.git
- edit file darknet\build\darknet\darknet.vcxproj
- modify CUDA 10.0.props as CUDA 9.1.props
- modify CUDA 10.0.targets as CUDA 9.1.targets
- 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
- open the project file darknet\build\darknet\darknet.sln in Microsoft visual studio community 2017
- change config as Release and platform as x64
- open the property page of darknet project.
- select general item at left tree list.
- choose platform tool kit as Visual studio 2015(v140).
- select VC++ Directory item at left tree list.
- Choose include directory property. Edit directory.
- 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
- Choose library directory property. Edit directory.
- Add new directory D:\Adrian\Software\opencv\build\x64\vc14\lib D:\Adrian\Software\cudnn-9.1-windows7-x64-v7.1\cuda\lib\x64
- Select Linker| input item at left tree list.
- Choose other dependency property. Edit it.
- Add string opencv_world412.lib into the textarea.
- Select CUDA C/C++| Common item at left tree list.
- Choose CUDA Toolkit Custom Dir property. Edit it.
- Add directory C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1
- Select CUDA C/C++| Device item at left tree list.
- Choose Code Generation property. Remove ;compute_75,sm_75
- Build the project.
- Change directory to darknet\build\darknet\x64
- Download yolov3.weights and place it to darknet\build\darknet\x64
- Execute command darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
Build yolo_cpp_dll steps
- Modify cuda version as your cuda version in darknet\build\darknet\yolo_cpp_dll.vcxproj
- Open yolo_cpp_dll.sln
- Follow Build darknet.exe Steps to build a yolo_cpp_dll.dll
- 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
- CUDA Error: CUDA driver version is insufficient for CUDA runtime version. It means that you need to upgrade your display driver. Please reference Install CUDA section.
- CUDA 9.0 does not work with the latest VS 2017 update.. Please download and install VC++ 2015.3 v140 toolset .
Reference
- Yolo-v3 and Yolo-v2 for Windows and Linux
- VS2015配置darknet项目时遇到MSB3721的解决办法
- How to uninstall CUDA9.0 and cuDNN under Win10?
- (Tensorflow-GPU) import tensorflow ImportError: Could not find 'cudnn64_7.dll'
- windows下darknet之yolo(gpu版本)安装
- Install OpenCV 4 on Windows (C++ and Python)
- Installing Darknet on Windows
- YOLO: Real Time Object Detection
如果你覺得這篇文章很有用,可以請我喝杯咖啡,讓我提供更多優質文章給您。感謝所有支持的朋友。
Vere Perrot 資訊人.科技人.行銷人,現為軟體分析師。定位自己為網路觀察家,永遠保持好奇心與熱情,學習跨領域新事物,希望最終能成為一個全方位的人。 Mail: vereperrot@gmail.com
沒有留言:
張貼留言