Restore comaptibilty with skimage 0.19 & fix corruption determinism #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi 👋 ,
thank you for providing
imagecorruptions
as open source package via github and via pypi!I try to bring the (currently unmaintained) package imgaug back to live. Fortunately the original maintainer provided an extensive collection of test cases I can run and check for breaking changes.
imagecorruptions
is one of the dependencies which changed it's behavior in the recent years. Mostly due to changes in upstream libraries and recent commits to this github repository.supported scikit-image version
For a smooth transition between the (now 4 years old)
imgaug
0.4.0 and an upcomming0.4.1
I would like to support atskimage
down to pre-0.19 times. Although the current master branch ofimagecorruptions
claims to supportskimage
down to version >= 0.15 the recent commits 2393c18 and 6b18b82 broke that compatibility.This pull request contains my suggestion on how to mitigate this depending on the installed
skimage
version. Since the fix is neither elegant nor pretty, I would suggest to introduce it as a temporary fix and drop thescikit-image
compatibility for < 0.19 completely in upcoming releases ofimagecorruptions
.impulse_noise determinism for scikit-image >= 0.19
The later versions of
scikit-image
use the "new" numpy random generator interface in contrast to the legacy one. This comes with two implications for everyone who wants to create reproducible outputs withimagecorruptions
:impulse_noise
outputscorrupt
function is used, the additional seed needs to be propagated toimpulse_noise
as keyword argument.I made the corresponding changes. At least for the
imgaug
test cases this is sufficient to restore reproducibility.glass_blur determinism with njit
Commit 2393c18 introduces a speed up for
glass_blur
by usingnumba
jit
. The flip side for this speed-up is broken reproducibility. Numba provides documentation on how to seednumpy
random functions within anjit
-decorated function.I added the corresponding changes to this pull request.
Again: Thank you for providing
imagecorruptions
and I hope that my changes will be helpful for otherimagecorruption
users!Best wishes,
Eric