<div dir="ltr"><div><div><div>Hi Martin,<br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
My problem my analysis uses much more memory than I expect.<br>
I attached output from the memory_profiler package, with which I tried<br>
to keep track of the memory consumption of my analysis.<br>
You can see that for an ~8MiB file that I used for testing,<br>
skimage.measure.label needs to use 56MiB of memory, which surprised me.<br></blockquote><span class="m_1518780076489020191gmail-"><br></span>I
haven't looked at it in much detail, but I did find what appear to be some unnecessary copies in the
top-level Cython routine called by skimage.morphology.label. I opened a PR to try and avoid this
here:<br><a href="https://github.com/scikit-image/scikit-image/pull/2701" target="_blank">https://github.com/scikit-<wbr>image/scikit-image/pull/2701</a></div><div class="gmail_quote"><br></div><div class="gmail_quote">However, I think that PR is going to give a minor performance improvement, but not help with memory use much if at all. I think the main reason for the increased memory usage is that the output type of the label function is int64 while your input is most likely uint8. This means that the labels array requires 8 times the memory usage of the uint8 input. I don't think there is much way around that without making a version of the routines that allows specifying a smaller integer dtype.<br><br></div>- Greg<br></div></div>