Udostępnij za pośrednictwem


YOLO on Azure Deep Learning Virtual Machine (DLVM - Windows)

[video width="854" height="480" mp4="https://msdnshared.blob.core.windows.net/media/2018/03/CherryBot-Fans-short.mp4"][/video]

Video credits: Greenwood Campbell at CherryBot Launch

YOLO "You only look once" by Joseph Redmon

A state of the art real-time object detection system that works using what I can only describe as magic: https://arxiv.org/abs/1612.08242

If you've seen any of the youtube.com videos demonstrating it, you may be curious to setup a development rig and play with it yourself.  However, setting up an environment isn't that simple as there are quite a few dependencies, all evolving at different cadence - depending on what you've already got installed on your machine you can end up in a bit of a mess and scratching you head as to why it's not working.

I spent a couple of hours this week setting up my Surface Book (with GPU) to experiment with YOLO.  However, after doing so could only get Tiny YOLO to work as kept hitting CUDA out of memory errors.  Then had a dawning moment, why don't I just use Azure's Deep Learning Virtual Machine (DLVM) with GPU?  Here is a guide to getting your own DLVM setup working with YOLO.

Note: There are numerous guides out there to walk through setting up a Windows development environment for YOLO.  I strongly encourage you to read the following first: https://pjreddie.com/darknet/ and https://github.com/AlexeyAB/darknet/blob/master/README.md.

Solution

In the Azure Portal, create a Deep Learning Virtual Machine (DVLM) NC-Series GPU on Windows (Linux also available).  Once provisioned, remote in:

Dependencies

The DVLM has a bucket load of tools already installed on it.  However, there are a few updates and additional libraries you need to install to get YOLO up and running.

Environment setup

  • Tweak the C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\include\crt\host_config.h file to update it with the latest VS version eg:

  • Clone AlexyAB's fork of the darknet repo: https://github.com/AlexeyAB/darknet.git
  • Copy the C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\VC\Auxiliary\Build\14.11\ props file to the darknet\build\darknet solution folder eg:

  • Open the darknet.sln solution - retarget the project

  • Build (Release x64 bit)
  • Open the solution/x64 output directory and you should see darknet.exe :)
  • Copy the OpenCV dependencies into the output directory above:

Enjoy.

Slight update 26/04/2018: After rebooting the machine at a later point I got the below error when running the darknet.exe.

"CUDA Error: CUDA driver version is insufficient for CUDA runtime version"

To get round this I just needed to re-install CUDA again (over the top)