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 Performance of Segment Replacement #640

Merged
merged 7 commits into from
May 3, 2020
Merged

Conversation

aleju
Copy link
Owner

@aleju aleju commented Mar 15, 2020

This patch improves the performance of segment
replacement (by average colors within the segments),
used in Superpixels and segment_voronoi().
The new method is up to around 7x faster, more for
smaller images and more segments. It can be slightly
slower in some cases for large images (512x512 and
larger).

This change seems to improve the overall performance
of Superpixels by a factor of around 1.1x to 1.4x
(more for smaller images).
It improves the overall performance of
segment_voronoi() by about 1.1x to 2.0x and can
reach much higher improvements in the case of very few
segments that have to be replaced.

Note that segment_voronoi() is used in Voronoi.

Added functions:

  • imgaug.augmenters.segmentation.replace_segments_

Added classes:

  • imgaug.testutils.temporary_constants (context)

aleju added 4 commits March 15, 2020 17:45
This patch improves the performance of segment
replacement (by average colors within the segments),
used in `Superpixels` and `segment_voronoi()`.
The new method is up to around 7x faster, more for
smaller images and more segments. It can be slightly
slower in some cases for large images (512x512 and
larger).

This change seems to improve the overall performance
of `Superpixels` by a factor of around 1.1x to 1.4x
(more for smaller images).
It improves the overall performance of
`segment_voronoi()` by about 1.1x to 2.0x and can
reach much higher improvements in the case of very few
segments that have to be replaced.

Note that `segment_voronoi()` is used in `Voronoi`.

Added functions:
* `imgaug.augmenters.segmentation.replace_segments_`

Added classes:
* `imgaug.testutils.temporary_constants` (context)
@codecov-io
Copy link

codecov-io commented Mar 15, 2020

Codecov Report

Merging #640 into master will decrease coverage by 1.31%.
The diff coverage is 93.75%.

@@            Coverage Diff             @@
##           master     #640      +/-   ##
==========================================
- Coverage   96.37%   95.06%   -1.31%     
==========================================
  Files          41       41              
  Lines       14683    14720      +37     
==========================================
- Hits        14150    13993     -157     
- Misses        533      727     +194     

@aleju aleju merged commit 7b27fbe into master May 3, 2020
@aleju aleju deleted the segment_replacement branch May 3, 2020 09:47
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