-
-
Notifications
You must be signed in to change notification settings - Fork 156
refactor: update image resizing implementation to use OpenCV and add … #268
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
Conversation
This might be worth taking a look at |
@r-bit-rry could you share some benchmark results with the old and new method? |
Also, why can't we use PIL for this? |
From the link I posted above, PIL seems to be the best choice |
I guess it doesn't really matter. One last note, the article is from 4 years ago. it might be worth retesting what he's done, or just take PIL whatever takes less time |
checked for regression and added a test, not for benchmark. generally speaking I'm not sure that now is the time to optimize performance, especially when the bottleneck is most likely the mlx model itself. looking over the updated benchmark it looks like PIL is the proper choice if using latest versions |
Awesome! Lets migrate to PIL then, it's already widely used in the project. Could you update the PR @r-bit-rry? |
Hey @r-bit-rry I went ahead and tested this and it works, thank you very much! However, there are more places where the change was needed and after testing different resampling techniques, I found that LANCZOS4 performs best overall with CV2 compared to CUBIC, INTER_AREA and others. It captures more details on images. #301 And for PIL bilinear was the the best. However, they don't numerically match
Here is an open issue that we can work towards closing that gap: #302 |
closing this issue:
#253
removing scipy dependency
chaging resize_image from scipy.ndimage.zoom to opencv resize
adding unittest to avoid regression