Skip to content
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
merged 38 commits into from
Aug 4, 2019
Merged

Improve segmentation map augmentation #302

merged 38 commits into from
Aug 4, 2019

Conversation

aleju
Copy link
Owner

@aleju aleju commented Apr 20, 2019

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.

@aleju
Copy link
Owner Author

aleju commented Apr 20, 2019

This will resolve #264 and #203.

@codecov-io
Copy link

codecov-io commented Apr 20, 2019

Codecov Report

Merging #302 into master will decrease coverage by 0.05%.
The diff coverage is 94.29%.

@@            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

aleju added 26 commits July 23, 2019 20:27
- 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.
@aleju
Copy link
Owner Author

aleju commented Aug 4, 2019

The latest commit should also fix issue #358

@aleju aleju merged commit 74a6ff9 into master Aug 4, 2019
@aleju aleju deleted the segmaps branch August 24, 2019 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants