How to use DeepLabCut with GPU on Windows

deeplabcut

#1

I followed the DeepLabCut installation instructions by using the provided dlc-windowsGPU.yaml file and running the following command:

conda env create -f dlc-windowsGPU.yaml

Now does this mean that in order to run

deeplabcut.train_network

I need to do it after doing activate dlc-windowsGPU? I am rather new to Anaconda environments and Tensorflow, and I just don’t know how to check that when I run deeplabcut.train_network that the GPU is actually being used. It is this step in one of the demos I am not clear on:

If you want to use your GPU, you need to exit here and either work from the Docker container, your own TensorFlow installation in an Anaconda env

What are exactly the steps I need to follow at this point? Do I do

(1) activate dlc-windowsGPU,
(2) ipython
(3) import deeplabcut
(4) import tensorflow as tf (is this unnecessary?)

Thank you


#2

You do not need to import tensorflow separately. Steps 1 to 3 should be sufficient to allow you to run deeplabcut functions.

There is a way to double-check that the GPU is accessible which involves importing tensorflow separately and then using some of its logging commands. However, this is probably not necessary - if your training is proceeding with any amount of speed, you can be confident the GPU is engaged. It would take excruciatingly long on a CPU :slight_smile:


#3

See the discussion at StackOverflow here https://stackoverflow.com/questions/38009682/how-to-tell-if-tensorflow-is-using-gpu-acceleration-from-inside-python-shell
for a quick way to check that Python can see the GPU.

Specifically:

import tensorflow
sess = tensorflow.Session(config=tf.ConfigProto(log_device_placement=True))


#4

You should activate the environment, then use all the deeplabcut commands inside the env. Check out the youtbe videos, perhaps they can be useful: https://www.youtube.com/watch?v=7xwOhUcIGio