Skip to content

Windows optimized YOLO / Darknet Compile, Train and Detect

Notifications You must be signed in to change notification settings

mwetzko/EasyYoloDarknet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyYoloDarknet

Compile and run https://github.com/AlexeyAB/darknet for Windows. Makes it easy to start with. Ideal for beginners.

Steps to follow

  1. Make sure you have Visual Studio 2022 or newer installed. All editions (community, professional, etc.) will work. Make sure you have installed the C++ and C# (.NET 6) workloads with it.
  2. Make sure you have git installed: https://git-scm.com/download/win.
  3. Make sure you have Powershell or Pwsh installed. Powershell is already part of Windows 10 or newer. So most users wont need this step. You can download it here: https://github.com/PowerShell/PowerShell
  4. Check out this repository
  5. Run bootstrap.ps1. This will compile darknet.dll and darknet.exe (if you prefer command line) in both x86 and x64 under \bin\x86\ and \bin\x64
    5.1 If you want to use CUDA/CUDNN, run bootstrap.ps1 -cuda [[sm_]<Number>] [-cudnn], e.g.:
    bootstrap.ps1 -cuda (translates to 'bootstrap.ps1 -cuda sm_52')
    bootstrap.ps1 -cuda sm_35
    bootstrap.ps1 -cuda -cudnn (translates to 'bootstrap.ps1 -cuda sm_52 -cudnn')
    bootstrap.ps1 -cuda sm_52 -cudnn
    bootstrap.ps1 -cuda 72 -cudnn (translates to 'bootstrap.ps1 -cuda sm_72 -cudnn')
    This will compile the x64 version of darknet with CUDA. x86 is not supported and will fallback to the version as if it was not compiled with the -cuda flag. Select sm_<Number> based on your graphics card.
    5.2 If you compile with -cuda (optionally with -cudnn) please follow the install instructions for CUDA/CUDNN below.
  6. Open src\Detect\Detect.sln with Visual Studio and run. You will be ask to choose an image to detect objects on. Try a picture with people or cars on it. If you have built darknet.dll without -cuda, detection might take minutes!

Important

Install CUDA/CUDNN (Optional)

  1. Download Nvidia CUDA Tookit (~2 to ~3 GB) https://developer.nvidia.com/cuda-downloads. I did the 11.7 version.

  2. Run the Nvidia CUDA Tookit Installer, select custom install to choose only CUDA. You are free to install all the software the installer offers, but for now we don't need Audio Drivers, Graphics or Physics!

  3. While installing, Nvidia CUDA Toolkit will check, if you have Visual Studio installed and will install proper Visual Studio references for you. These are not necessary for this project, but will help you creating CUDA applications with Visual Studio.

  4. Download CUDNN. Either register with Nvidia to get the latest version of CUDNN or download one of the archive versions. Make sure the major version of CUDNN matches the major version of CUDA. So if you have installed CUDA 11.7, you have to download CUDNN for CUDA 11.x https://developer.nvidia.com/rdp/cudnn-archive. For me it said 'Download cuDNN v8.4.1 (May 27th, 2022), for CUDA 11.x'

  5. After download, extract the CUDNN zip archive, and copy all contents where you want. I copied all to the folder, where the CUDA Toolkit was installed. But instead of copying them into the CUDA folder, I created a separate folder named CUDNN next to the CUDA folder.
    image

  6. Inside this new folder, I created a folder named 11.x.
    image

  7. Into that folder copy all folders you extracted from the CUDNN zip file:
    image

  8. Create the environment variable CUDNN pointing to the folder we just created:
    image

About

Windows optimized YOLO / Darknet Compile, Train and Detect

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published