Delen via


Running YOLO v2 on the Microsoft Data Science Virtual Machine

This week I attended the Industry Partner workshop at the Future of Infrastructure and Built Environment at the University of Cambridge. During the day I had a number of conversations with construction industry professionals and one of  the topics we got into talking about how technology from HoloLens, to Data Science is revolutionising the construction industry.

During the breakouts we got into a discussion around the automation and monitoring of works on constructions sites from using tools such as Deep Learning to simply having drones or video capturing and analysing images of progress.

I remembered seeing an a article around this a few years ago, which showed the work from the University of Illinois one of the Project involves tracking the activity of individual construction workers in video footage https://www.technologyreview.com/s/540836/new-boss-on-construction-sites-is-a-drone/ but a huge downfall for the system was that the data and output was simply not in real time.

image

Improvement in Deep Learning

We then got into the discussion of how modern day technology and services make ML, AI so much more accessible and significantly improve the success of object and activity identification and recognition in real time.  One of my colleagues Jamie Dalton is very much into this space and a recent tool he has been using is called YOLO You only look once,  which you can run on Azure Deep Learning Virtual Machine Deep Learning Virtual Machine.

So what is YOLO

YOLO is a state of the art real-time object detection system that works using what I can only describe as amazing. Jamie has been doing some amazing work with YOLO and you can see this at his blog https://blogs.msdn.microsoft.com/jamiedalton  

With the Azure's Deep Learning Virtual Machine (DLVM) with GPU its super easy for student and academic to now setup a real time detection system and thanks to the work Jamie has been doing here is a quick  guide to getting your own DLVM setup working with YOLO.

All students now get a FREE Azure Account with no credit card required which give $100 of Azure credit so this is great way to try a small experiment into deep learning https://aka.,ms/azure4students

Solution

In the Azure Portal, create a Deep Learning Virtual Machine (DVLM) NC-Series GPU on Windows (Linux also available).  Once provisioned, you can RDP into the environment and complete your image/object recognition projects, if you want to spin up a standalone new VM 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.

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.

Please note: If you get the error "CUDA Error: CUDA driver version is insufficient for CUDA runtime version" when running the darknet.exe.

You simply need to re-install CUDA again

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:

Learning more about YOLO and getting started tutorials

There some great tutorials at https://www.youtube.com/watch?v=PyjBd7IDYZs&list=PLX-LrBk6h3wSGvuTnxB2Kj358XfctL4BM