Giter Site home page Giter Site logo

SLIC about embedded_gcnn HOT 11 OPEN

rusty1s avatar rusty1s commented on July 1, 2024
SLIC

from embedded_gcnn.

Comments (11)

rusty1s avatar rusty1s commented on July 1, 2024

I believe SLIC does only guarantee equal number of superpixels in the skimage implementation if you set enforce_connectivity to False.

from embedded_gcnn.

tonyandsunny avatar tonyandsunny commented on July 1, 2024

Yes!I just try it. They can get the equal number of superpixels when set it to false. But the number of superpixels obtained is not equal to the 'num_segments=100' (I just set the parameter).

from embedded_gcnn.

rusty1s avatar rusty1s commented on July 1, 2024

So you have equal number of superpixels, but there are less than 100?

from embedded_gcnn.

tonyandsunny avatar tonyandsunny commented on July 1, 2024

Yes! And when the 'num_segments=100', the equal number of superpixels is 121 more than 100.
Why the obtained superpixels is not 100?

from embedded_gcnn.

rusty1s avatar rusty1s commented on July 1, 2024

I am not really sure, sorry. Maybe you can consult the sckit-image authors for help

from embedded_gcnn.

tonyandsunny avatar tonyandsunny commented on July 1, 2024

OK! Thank you very much!

from embedded_gcnn.

tonyandsunny avatar tonyandsunny commented on July 1, 2024

Is this code a Splineconv model? Sorry, I am not familiar with this code and Splineconv.

from embedded_gcnn.

rusty1s avatar rusty1s commented on July 1, 2024

Not really, it is my masters thesis. You can find the SplineConv implementation here.

from embedded_gcnn.

tonyandsunny avatar tonyandsunny commented on July 1, 2024

I try use' embedded_gcnn code' to get the cifar10 dataset. And I modified it to the 'pytorch_geometric dataset' format. Then I run the mnist_graculs.py (loading the cifar10 dataset) and the result is just about 0.43. Maybe I was wrong. Could you give some advices?

from embedded_gcnn.

rusty1s avatar rusty1s commented on July 1, 2024

This is actually quite hard to say. It could be anything from wrong data handling to bad hyperparameters.

from embedded_gcnn.

tonyandsunny avatar tonyandsunny commented on July 1, 2024

while num_left > 0:

            min_batch = min(batch_size, num_left)
            images, labels = dataset.next_batch(min_batch, shuffle=False)
            num_left -= min_batch
            if batch_num == 0:
                label_array = labels
            else:
                label_array = np.concatenate((label_array, labels), axis=0)
            for i in xrange(labels.shape[0]):
                #data = preprocess_algorithm(images[i])
                features, node_slice, edge_index, edge_slice, pos = preprocess_algorithm(images[i])
                #edge_slice_num = edge_slice #每张图片中边的数目
                #node_slice_num = node_slice#每张图片中节点的数目
                if batch_num == 0 and i==0:
                    features_array = features
                    pos_array = pos
                    edge_index_array = edge_index
                else:
                    features_array = np.concatenate((features_array,features),axis=0)
                    pos_array = np.concatenate((pos_array, pos), axis=0)
                    edge_index_array = np.concatenate((edge_index_array, edge_index), axis=1)


                node_slice_list.append(node_slice+node_slice_list[-1])
                edge_slice_list.append(edge_slice+edge_slice_list[-1])
                #data = (features_array, node_slice_list, edge_index_array, edge_slice_list)
                j += 1
                max_index = torch.from_numpy(edge_index)[0,:].max()
                size = torch.from_numpy(pos).size(0) - 1
                assert max_index == size
                assert edge_slice == edge_index.shape[1]
            #_save(data_dir, self._names[j], data)
            _print_status(data_dir,
                          100 * (1 - num_left / dataset.num_examples))
            batch_num+=1

        _print_status(data_dir, 100)
        data = (features_array, node_slice_list, edge_index_array, edge_slice_list,pos_array)

        if isinstance(data, np.ndarray):
            data = (data, label_array)
        else:
            data = data + (label_array,)
        np.save(data_dir, data)

        #torch.save((self.data, self.slices), path)
        print()

The above is the code I modified after dataset.py. In order to be able to change the data format of pytorch-geometric, I feel that there should be no big problem.
One thing is that when I use the slic algorithm to get a super-pixel block, the number of super-pixel nodes obtained for each image is different, so I define node_slice to record the super-pixel block of each image.

from embedded_gcnn.

Related Issues (9)

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.