Coder Social home page Coder Social logo

Comments (3)

varunjampani avatar varunjampani commented on June 1, 2024

Our network first learns deep pixel features which are then used for computing distance between pixels and superpixels. We do iterative clustering using deep features. After each iteration of differentiable SLIC, we obtain superpixel centroid features. You can use the following function to convert deep pixel features into superpixel features:

spixel_feat = L.SpixelFeature2(pixel_features,
                                                    pixel_assoc,
                                                    spixel_init,
                                                    spixel_feature2_param =\
        dict(num_spixels_h = num_spixels_h, num_spixels_w = num_spixels_w))

Does this answer your question?

from ssn_superpixels.

pinkfloyd06 avatar pinkfloyd06 commented on June 1, 2024

Hi @varunjampani ,

Thank you for your answer. Yes this is what l need. Can l also get the coordinates of each superpixel (gravity center) and the coordinates (index(x,y)) of each pixel ?

Thank you

from ssn_superpixels.

varunjampani avatar varunjampani commented on June 1, 2024

You can compute 'XYRGB' pixel features using the following layer:

pixel_features = L.PixelFeature(img,
                                      pixel_feature_param = dict(type = P.PixelFeature.POSITION_AND_RGB,
                                                                 pos_scale = float(pos_scale),
color_scale = float(color_scale)))

And, then pass these pixels features onto 'SpixelFeature2' layer to compute XYRGB gravity center for superpixels:

spixel_feat = L.SpixelFeature2(pixel_features,
                                                    pixel_assoc,
                                                    spixel_init,
                                                    spixel_feature2_param =\
        dict(num_spixels_h = num_spixels_h, num_spixels_w = num_spixels_w))

And, you can convert pixel-superpixel associations into 'superpixel index' using the following function in 'create_net.py':

def compute_final_spixel_labels(pixel_spixel_assoc,
                                spixel_init,
                                num_spixels_h, num_spixels_w):

    # Compute new spixel indices
    rel_label = L.ArgMax(pixel_spixel_assoc, argmax_param = dict(axis = 1),
                         propagate_down = False)
    new_spix_indices = L.RelToAbsIndex(rel_label, spixel_init,
                                       rel_to_abs_index_param = dict(num_spixels_h = int(num_spixels_h),
                                                                     num_spixels_w = int(num_spixels_w)),
                                                                     propagate_down = [False, False])

    return new_spix_indices

from ssn_superpixels.

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.