ImageAI icon indicating copy to clipboard operation
ImageAI copied to clipboard

GPU Detection not working outside of Google Colab

Open StevenMapes opened this issue 4 years ago • 0 comments

I'm new to ImageAI and ML in general but I'm having real trouble trying to get ImageAI working using GPUs rather than just CPUs.

I've managed to make it work in Google Colab by using the below

from imageai.Detection.Custom import DetectionModelTrainer
trainer = DetectionModelTrainer()
trainer.setModelTypeAsYOLOv3()
trainer.setDataDirectory(data_directory="/content/gdrive/MyDrive/ai-training/test")
trainer.setGpuUsage(1)
trainer.setTrainConfig(object_names_array=["Item 1", "Sample 2"], batch_size=4, num_experiments=200)
trainer.trainModel()

But when I've tried this locally as well as on Azure, AWS (EC2 P3) and locally nothing I do makes it run using the GPU it's always using CPU only. I've tried it with Tensorflow-GPU 2.4.0, 2.4.1 and 2.5.1 though the latter just doesn't work anyway. all the machines I've tested with have GPUs with the some being more powerful that the T4 on Colab and others have 6 or 8 GPUs. I've looked through the docs, the ReadTheDocs and the only things I've found are issues where the setGpuUsage was being called as well as the PyDoc comments in the class.

Can anyone help or is it simply an issue with the current versions of TensorFlow?

StevenMapes avatar May 17 '21 19:05 StevenMapes