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

Update inference.py #103

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mst-rajatmishra
Copy link

Hi,
I tried making Some Changes,

  1. I’ve replaced print statements with logging to track progress and handle errors.
  2. The code has been broken into smaller, more manageable functions:
  • load_faces handles loading and cropping faces from image paths.
  • process_source_and_target handles loading the source and target images.
  • perform_inference handles the inference step.
  • enhance_faces handles the optional super-resolution step.
  • save_output handles saving the result (either a video or image).
  1. The inference step is wrapped in torch.no_grad() to save memory and speed up processing.

  2. Errors during face cropping are logged to ensure smooth execution even if a face is not detected in an image.

Thank You,
Rajat Mishra.

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

Successfully merging this pull request may close these issues.

1 participant