DonsetPG / narya

The Narya API allows you track soccer player from camera inputs, and evaluate them with an Expected Discounted Goal (EDG) Agent. This repository contains the implementation of the flowing paper https://arxiv.org/abs/2101.05388. We also make available all of our pretrained agents, and the datasets we used as well.
MIT License
166 stars 48 forks source link

Keras Models for Homography and Key Points Estimation not using GPU #30

Closed Muaz65 closed 3 years ago

Muaz65 commented 3 years ago

I am Pytorch User and have not much idea about tensorflow. I am trying to run Keras Models (Homography, Keypoints) on GPU. I have RTX 3090 with CUDA 11.2. I installed Tensorflow-gpu==2.2.0 intsead of simple tensorflow and also tried adding these lines before loading models. with tf.device('/GPU:0'): Can you please guide me how can i load these models on GPU instead of CPU.

DonsetPG commented 3 years ago

Hey, You should try 2 things:

  1. uninstall tensorflow & install tensorflow-gpu
  2. uninstall mxnet & install mxnet-cu101

You already did the first step, and since Keras is now fully encapsulated within Tensorflow, it should use your GPU directly. You can make sure of that with:

import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
  1. If it stills do not detect your GPU, try to reinstall a GPU compatible version of mxnet & retry.

Let me know if this helps, Cheers

Muaz65 commented 3 years ago

@DonsetPG tf was detecting GPU. The issue was with CUDATOOLKIT. When i installed torch with bundled CUDA 11.0, the model automatically started working on GPU.