If Caffe was built for the NVIDIA GPU, these lines will speed things up a LOT. Insert this code just after the "import caffe" line.
# If your GPU supports CUDA and Caffe was built with CUDA support,
# uncomment the following to run Caffe operations on the GPU.
caffe.set_mode_gpu()
caffe.set_device(0) # select GPU device if multiple devices exist
If Caffe was built for the NVIDIA GPU, these lines will speed things up a LOT. Insert this code just after the "import caffe" line.