fer icon indicating copy to clipboard operation
fer copied to clipboard

Doesn't use GPU

Open linguist89 opened this issue 3 years ago • 4 comments

I'm running the package using Google Colab and the GPU is detected and available, however the FER packages doesn't seem to use it. I've run it before on the same setup and it worked using the GPU, but now it doesn't. Is there anyone that has the same problem?

linguist89 avatar Jun 18 '21 15:06 linguist89

Can you please try enclosing the inference in with tf.device('/device:GPU:0') and see if it helps?

with tf.device('/device:GPU:0'): detector = FER(mtcnn=True)

Video predictions

video = Video(videofile)

Output list of dictionaries

raw_data = video.analyze(detector, display=False)

On Fri, Jun 18, 2021 at 5:19 PM linguist89 @.***> wrote:

I'm running the package using Google Colab and the GPU is detected and available, however the FER packages doesn't seem to use it. I've run it before on the same setup and it worked using the GPU, but now it doesn't. Is there anyone that has the same problem?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/justinshenk/fer/issues/23, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOLMZACDPIAD3HKOGBLRGDTTNPYHANCNFSM4653YMWA .

JustinShenk avatar Jun 22 '21 12:06 JustinShenk

@justinshenk Thanks for the reply. I have tried that, but it still doesn't work. I've scoured the internet forums and it seems that there has been a Colab update and the CUDA and tensorflow version are now different. I think that might be the reason, but I don't know how to fix that.

linguist89 avatar Jun 23 '21 15:06 linguist89

@justinshenk I'm continuing my comments from this issue since I didn't want to hijack his question. I've got the GPU working, but it seems that it was working the whole time only it uses about 5% of the GPU, so it's only marginally faster than CPU. I found a little bash script that plots the GPU usage GPU_usage

Is there a way to force the code to use more GPU?

linguist89 avatar Jul 12 '21 09:07 linguist89

Batching the frames and adding a queue would allow speeding it up and increasing GPU usage. It would be great if someone would make a PR for this

JustinShenk avatar Feb 28 '22 21:02 JustinShenk