Giter VIP home page Giter VIP logo

Comments (7)

atpolonsky avatar atpolonsky commented on June 18, 2024 1

Your function does work, though it appears to leave a thread hanging so I needed to kill the python script when I used it. I tested it out against a vectorized approach I found here: https://stackoverflow.com/a/54736464.

I subbed in your version of fastremap.unqiue in place of numpy's, and with a test volume of 500 million voxels and 3000 labels, the linked function above uses ~25GB of ram and runs in 55 seconds. The fastremap point_cloud function uses ~60 GB of RAM (borrowing about half of this from virtual memory on my hardware) and runs in 100 seconds.

I agree that this kind of function is definitely useful for my field as well and from looking into it I think others would benefit from a faster implementation. Either way, a dramatic improvement from the simple for loop above.

from connected-components-3d.

william-silversmith avatar william-silversmith commented on June 18, 2024

If I understand correctly, is it that you'd like to convert the array into a point cloud? If you want to return every voxel as a 3-tuple, while there might be some leeway by playing with the data type, you should expect to use 3x the size of the array at minimum because you'll need 3 integers to represent the position of the label whereas before the position was stored implicitly using a single integer.

from connected-components-3d.

atpolonsky avatar atpolonsky commented on June 18, 2024

You could think of it as a point cloud, yes where each label location is represented by a 3 tuple. I'm looking to replace this kind of operation, which is shown below in its simplest, least efficient implementation:

connectivity = 6
labels_out = cc3d.connected_components(data, connectivity=connectivity)
labels_idx = []
for i in range(1,np.max(labels_out)+1):
idx = np.argwhere(labels_out == i)
labels_idx.append(idx)

from connected-components-3d.

william-silversmith avatar william-silversmith commented on June 18, 2024

I ran your example code against 128 MVx of data and it looks like it will take about three hours to run.

image

This sounds like a good candidate for a new fastremap function. Point clouds are used a lot in my field, it's a little crazy they're so expensive to generate.

from connected-components-3d.

william-silversmith avatar william-silversmith commented on June 18, 2024

This is a rough implementation, but maybe you'll be able to use it?

https://github.com/seung-lab/fastremap/tree/wms_point_cloud

from connected-components-3d.

william-silversmith avatar william-silversmith commented on June 18, 2024

It's been a while, but I am releasing fastremap 1.12.0 which will include a point_cloud function that should be much faster and lower memory than what I previously showed you, maybe even better than the numpy vectorized. The measuring tools on my new arm64 laptop are not reliable in giving memory estimates, so it's difficult for me to make more quantitative statements.

from connected-components-3d.

william-silversmith avatar william-silversmith commented on June 18, 2024

Closing issue due to inactivity. Please reopen if you want to discuss further!

from connected-components-3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.