Open godisme1220 opened 4 months ago
Hey there, thanks for pointing this out! There should definitely be an easy way to do this in the future when I restructure the library. For now, I could only give you a "hacky" solution by adjusting the Cropper
class. Just make sure to set batch_size=1
So you could just copy the given code into a file like cropper_no_resize.py
and then simply use the updated class, e.g., with the demo data from this repository:
from cropper_no_resize import CropperNoResize
# Initialize cropper
cropper = CropperNoResize(
batch_size=1,
output_format="jpg",
face_factor=0.7,
strategy="largest",
)
# Process images in the input dir
cropper.process_dir(input_dir="demo/input_images")
Sorry about the messy solution, I hope to greatly rework the package sometime in the future. Let me know if anything else pops up and let's keep this open as an enhancement~
Also, face attribute grouping will not work with these modifications (further adjustments would be required) but I assume you would not need those
Thanks for your amazing help! it works! But a little issue I encounter, that is the output image not exactly 1:1, how can I fix it?
Eugene regards
Oh, I found a dumb way, but it works!
max_side = max(width, height)
width = max_side
height = max_side
output_size = (width, height)
I simply enforce the width and height same value base on which one is larger, then pass to self._reinit_landmarks_target(output_size)
Haha yup, gald it works!
Hello,
Thank you for this amazing library! I have a question regarding the face cropping functionality. Currently, the cropped face images are resized to a fixed output size defined by output_size. However, I need the cropped face images to retain their original size without any resizing.
Is there a way to achieve this using the current implementation? If not, what modifications would you suggest to allow the face crops to be saved at their original size?
And is there anyway to not rotate the face?
Thank you for your help!