-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Fix face swapping crash due to None face embeddings #980
base: main
Are you sure you want to change the base?
Conversation
- Add explicit checks for face detection results (source and target faces). - Handle cases when face embeddings are not available, preventing AttributeError. - Provide meaningful log messages for easier debugging in future scenarios.
Reviewer's Guide by SourceryThis pull request addresses a crash issue in the face swapping functionality that occurs when face embeddings are not available due to face detection failures. It introduces explicit checks for face detection results (source and target faces) and handles cases where either face is not detected, preventing AttributeError. Additionally, it provides meaningful log messages for easier debugging. Sequence diagram for face swapping with face detection checkssequenceDiagram
participant FrameProcessor
participant FaceDetector
participant FaceSwapper
FrameProcessor->>FaceDetector: Detect source_face and target_face
alt source_face and target_face are detected
FrameProcessor->>FaceSwapper: swap_face(source_face, target_face, temp_frame)
FaceSwapper-->>FrameProcessor: temp_frame (with swapped face)
else source_face or target_face is not detected
FrameProcessor->>FrameProcessor: Log error message
end
FrameProcessor-->>FrameProcessor: Returns temp_frame
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @aaddyy227 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider using a logging framework instead of print statements for better control and organization of log messages.
- It might be helpful to include the reason for face detection failure in the log messages to aid debugging.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Prevent crashes when face embeddings are not available by adding explicit checks for face detection results and handling cases where face embeddings are missing. Also, add more logging for easier debugging.
Bug Fixes: