-
Notifications
You must be signed in to change notification settings - Fork 101
NEW: Add stainaugment feature for stain augmentation #181
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
Codecov Report
@@ Coverage Diff @@
## develop #181 +/- ##
========================================
Coverage 99.79% 99.80%
========================================
Files 40 41 +1
Lines 2979 3057 +78
Branches 499 507 +8
========================================
+ Hits 2973 3051 +78
Misses 1 1
Partials 5 5
Continue to review full report at Codecov.
|
…feature-stainaugment
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
simongraham
left a comment
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.
Nice work. Few small things to change but generally it’s nice. Happy to merge when those things are addressed
|
Many thanks to @simongraham and @Srijay-lab for reviewing this PR. I have incorporated your comments in ff0e65c. Please let us know if you are happy with the changes (and test the code on your system if possible) so @shaneahmed can merge this PR. |
shaneahmed
left a comment
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.
Thanks @mostafajahanifar
Please address my comments and add stain augmentation feature to usage.rst
shaneahmed
left a comment
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.
Thanks @mostafajahanifar
Introducing
stainaugmenttool for generating stain-augmented images from an input image. This class can be used stand-alone or in albumentations augmentation pipelines.The process works as bellow:
stain_matrixor astain_matrixthat has been calculated based on 'Vahadane' or 'Macenko' methods.stain_matrix.sigma1andsigma2parameters:alpha = np.random.uniform(1 - self.sigma1, 1 + self.sigma1)beta = np.random.uniform(-self.sigma2, self.sigma2)Providing the pre-extracted
stain_matrixon class initialization have two benefits:stainaugmentcan be used for small patches on-the-fly during the model training (because the bulk of stain matrix extraction or dictionary learning is eliminated)By setting the parameters, this function allow the user to augment the stain around a target stain matrix i.e., normalize the stain to a target image and then augment it.
Class definition and structure
Check the functionality
Add support for albumentations
Complete the docstring and writing examples
Complete the test and coverage
Add an example to "Stain Normalization" notebook