-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Simplify and strengthen rotate_facial_area #1047
Simplify and strengthen rotate_facial_area #1047
Conversation
|
||
# Normalize the witdh of the angle so we don't have to | ||
# worry about rotations greater than 360 degrees | ||
angle = angle % 360 |
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.
angle will be positive always because of the module, so you can get rid of the direction because it will be 1 always
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.
That's not right.
75 % 360 == 75
-75 % 360 == -75
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.
This is my experiment.
Python 3.9.16 (main, Jan 11 2023, 16:05:54)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = -75
>>> a % 360
285
>>>
>>>
>>> b = 75
>>> b % 360
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.
still, both outputs will work as is
never mind this
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.
Ouch ... python mod operator is pretty fucked up. Every other language and calculators keeps the sign of dividend not the divisor.
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.
Would you please run this code and share its output here import matplotlib.pyplot as plt
img_paths = ["dataset/dataset/img11.jpg", "dataset/img11_reflection.jpg"]
for img_path in img_paths:
results = DeepFace.extract_faces(img_path = img_path)
img = results[0]["face"]
plt.imshow(img)
plt.show() |
It is the output for img11.jpg, I wonder the output of img11_reflection.jpg also. |
This strengthen
rotate_facial_area
by :angle
: positive values for clockwise, negative for anti-clockwiseIn previous implementation direction could be any number causing unwanted results.
Also fixes #1045