Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inference on CPU #18

Closed
guyreading opened this issue Nov 19, 2020 · 6 comments
Closed

Inference on CPU #18

guyreading opened this issue Nov 19, 2020 · 6 comments

Comments

@guyreading
Copy link

Is there a way of using the trained weights & do inference using CPU only? My GPU can't handle inference with the current settings...

@guyreading
Copy link
Author

Solved: used with torch.cuda.amp.autocast(): in kernel_utils, line 334, for the subsquent 3 lines. & then changed all pointers to cuda with "cpu", removed the .half()'s where they were as incompatible with cpu use.

@epiqueras
Copy link

@guyreading @selimsef torch.cuda.amp.autocast() is not available in PYTORCH="1.4" which the Docker image is built for.

Is there a workaround you would recommend?

@selimsef
Copy link
Owner

selimsef commented Dec 30, 2020

@epiqueras There is no need to use amp for inference on CPU. You can just change half -> float inputs and device to "cpu" as @guyreading did.

@epiqueras
Copy link

@selimsef yeah, I ended up figuring that out reading the docs.

Thanks for confirming!

This doesn't do too well on side shots, does it? I tested it, and it gave me ~0.3 for an obviously fake video.

@selimsef
Copy link
Owner

@epiqueras Yes, multiple reasons for that:

  • less training data for that view
  • In the training set there were two actors per video with side shots, one of them was not fake. So it created a lot of noise in training.
  • MTCNN might miss faces on side shots or bounding boxes won't be accurate

@epiqueras
Copy link

@selimsef interesting; thanks for the info.

I tested it on frontal webcam shots, and it works almost perfectly.

What are your thoughts on using MTCNN vs. using some sort of reversal/adaptation of the feedback loops the networks that generate deepfakes use? I assume that would only work for targeting specific algorithms and using approaches like yours can work against a broader range of techniques?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants