GithubHelp home page GithubHelp logo

Comments (7)

william-silversmith avatar william-silversmith commented on July 3, 2024 1

from connected-components-3d.

ckolluru avatar ckolluru commented on July 3, 2024 1

Thanks @william-silversmith!

from connected-components-3d.

william-silversmith avatar william-silversmith commented on July 3, 2024

Hi!

Thanks for writing in.

The first centroid is for label 0 and the second is for label 1.

I took at look at your example, and it seems the reason is a loss of precision in float32 as its summing across a large area. When I upgrade from float to double, the numbers come out right. Float32 can represent a large range, but only has full precision for integers up to 10^7.

512 * 511 / 2 * 512 * 512 = 34e9

I'll see if I can find a nice fix for this.

from connected-components-3d.

william-silversmith avatar william-silversmith commented on July 3, 2024

It looks like this used to be float64 but there was a problem with memory consumption.

13d7c49

Hmm....

from connected-components-3d.

ckolluru avatar ckolluru commented on July 3, 2024

Thanks for looking into this.

If I change the test image to be ones only between [10:20, 10:20, 10:20] and zeros elsewhere the background centroid is still around [64, 64, 64]. That shouldn’t be the case right?

from connected-components-3d.

william-silversmith avatar william-silversmith commented on July 3, 2024

That's also loss of precision and changing the foreground doesn't affect it that much since the vast majority of background pixels are black in both scenarios. When I change it to double, it gives something like the right result (256.29568989, 256.29568989, 256.29568989) which is still a bit off...

I have to figure out some way to prevent the sum from blowing up so high without sacrificing accuracy and memory efficiency.

from connected-components-3d.

william-silversmith avatar william-silversmith commented on July 3, 2024

It was kind of tricky to figure out a method for doing this that used less memory than simply bumping to double, so I'll release a new version with that once the build completes. The precision for double is actually pretty good, I forgot to account for the large "hole" in the data before.

I'll let you know when the new version is released.

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.