-
Notifications
You must be signed in to change notification settings - Fork 224
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
Alternatives to opencv
(cv2
) #532 [Solved]
#853
base: master
Are you sure you want to change the base?
Conversation
Hi @Dilip-Jain and thanks for your contribution, this looks very helpful! I would suggest removing the Have you had a chance of running some of the example notebooks that use these transforms and see if it all works as expected? E.g. grepping for |
Hi @jklaise, Regardless, while making modifications, I compared the outcomes of the previous and the updated code using random images and calculated the Mean Squared Error (MSE) and Structural Similarity Index (SSI). Both scores were close to 1, indicating highly similar outputs. In fact, based on these scores, I decided which implementation to use—whether it was scipy, skimage, or even a custom numpy convolution—to replace the (then) existing code. Lastly, just so we are on the same page, the current commit has cv2, but only as an optional dependency and you want me to remove it in its entirety. The next commit (updated pull request ⬇️) will do exactly that! 😊 |
@Dilip-Jain apologies, I somehow missed your latest comment. I've also realized that the functions are not actually used to produce runtime corruptions either in the codebase or the examples. I'm currently looking at the PR and testing it myself (basically checking if outputs are the same using |
Sure @jklaise, |
Hi @jklaise, |
Issue No. #532 [Solved]
Problem
@jklaise mentions -
Solution
Hello maintainers and contributors,
I am pleased to submit this pull request which addresses the concern of OpenCV being a heavy dependency in the image perturbations module (alibi_detect/utils/perturbation.py). The requirement of
cv2
(opencv
), as realized, was limited and eliminable as it was used only for making image perturbations. In this pull request, I have replaced specific OpenCV functionalities with the lighter and already required libraries,scikit-image
andSciPy
, ensuring that no new external libraries are introduced.Fixes #532
Key Replacements:
Benefits of the Changes:
opencv-python
) based on their specific use cases, preventing unnecessary bloat for those who don't require it.Thank you for considering this pull request, and I welcome any feedback or suggestions for further improvements.