-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Improve segmentation map augmentation #302
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #302 +/- ##
==========================================
- Coverage 95.6% 95.55% -0.05%
==========================================
Files 32 32
Lines 10151 10509 +358
==========================================
+ Hits 9704 10041 +337
- Misses 447 468 +21 |
- Rename SegmentationMapOnImage to SegmentationMapsOnImage. - Internal array is now - Always int32. - Always of shape (H,W,C), with C being the channels and not the classes. - No longer generated via np.eye(), i.e. memory demand does not grow with number of classes. - Remove nb_classes arg. - Change .input_was attribute content. - SegMapsOnImage no longer accepts float32 array inputs. - SegMapsOnImage no longer accepts uint inputs if they are 32bit or more. Only uint8 and uint16 are accepted. - Remove background_class_id args. - Remove background_threshold args. - draw() and draw_on_image() now return lists of arrays, one per C. - Refactor draw() to be thin wrapper around draw_on_image(). - copy() has now args 'arr' and 'shape'. - deepcopy() has now args 'arr' and 'shape'. - pad(), pad_to_aspect_ratio(), resize() now call deepcopy() to generate new SegMapsOnImage instances. - Removed SegMapsOnImage.to_heatmaps() and .from_heatmaps(). - Remove SegMapsOnImage.get_arr_int(). - Add SegMapsOnImage.get_arr(). - SegMapsOnImage.resize() now uses NN interpolation by default.
numpy.clip() in 1.17 no longer returns int64 for int64 inputs, but instead float64 (+warning if using out=...). This causes cascading failures throughout the library. Many augmenters now no longer support int64 and some lower-resolution dtypes or can give less guarantuees. This commit adapts various augmenters to this new situation (actually, in most cases just quick fixes to get running again). It also limits most stochastic parameter's returned dtypes to uint32, int32 and float32 to ensure that no higher-resolution dtypes are necessary during augmentation.
The latest commit should also fix issue #358 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds dedicated segmentation map augmentation (previously: wrapped around heatmap augmentation).
Stays always within integer space, instead of switching to floats.
Should significantly improve performance and lower memory consumption during segmentation map augmentation.
Required memory now grows with the number of segmentation map array components instead of growing with the number of classes (and height/width of the array).
Several breaking changes, see changelog.