It seems that Darknet was only using the CPU. So I searched a little and found this bug as well as another bug that says that we should add -gpus 0
and -i 0
to our call. respectivvely.
Adding that, we get:
!cd $DN; ./darknet detector -i 0 -dont_show -map train data/obj.data cfg/yolov3-train.cfg backup/yolov3-train_last.weights -gpus 0
But what about the other options like AVX? If we can force Darknet to use the GPU we could add those back to the Makefile. right?
# https://stackoverflow.com/questions/39086/search-and-replace-a-line-in-a-file-in-python
f = open(DN + '/Makefile', 'r')
lines = ''
for line in f:
if line.find('GPU=0') != -1:
line = line.replace('GPU=0', 'GPU=1')
if line.find('CUDNN=0') != -1:
line = line.replace('CUDNN=0', 'CUDNN=1')
if line.find('CUDNN_HALF=0') != -1:
line = line.replace('CUDNN_HALF=0', 'CUDNN_HALF=1')
if line.find('OPENCV=0') != -1:
line = line.replace('OPENCV=0', 'OPENCV=1')
if line.find('AVX=0') != -1:
line = line.replace('AVX=0', 'AVX=1')
if line.find('OPENMP=0') != -1:
line = line.replace('OPENMP=0', 'OPENMP=1')
lines += line
f.close()
g = open(DN + '/Makefile', 'w')
g.write(lines)
g.close()
Unfortunately, it still created 6 permanent CPU threads
, which makes me think that it only uses CPUs. How unfortunate.