GithubHelp home page GithubHelp logo

Comments (2)

duhaime avatar duhaime commented on August 26, 2024

Thanks for reaching out @AGrosserHH ! As you noticed, we've moved to a python module setup, but it's easy enough to find and modify the module to get this information.

First things first, one should find where the pixplot module code is. To do that, you should be able to type python and hit enter in a terminal. That will drop you into the Python interpreter (you'll know you're in the interpreter if you see >>> as your terminal prompt).

Once you're in the interpreter, try typing:

import pixplot
print(pixplot.__file__)

That should tell you the path like:

.../pixplot-{version}/pixplot/__init__.py

If you navigate to the folder that contains that init.py file, you should see another file pixplot.py; that's the file we'll want to change to display the info you discuss above.

Once you open up that file, you'll see a function get_centroids(). In that function, there's a variable z with an attributelabels_ that contains the cluster assignments of each input image in order (so the ith value in z.labels_ is the cluster id for the ith image in kwargs['image_paths']). To get the number of images in each cluster and the names of the images in each cluster, one can therefore add (somewhere after z is fully populated):

cluster_map = defaultdict(list)
  for idx, i in enumerate(z.labels_):
    cluster_map[i].append(kwargs['image_paths'][idx])
  for i in cluster_map:
    print(' * cluster {} has {} images: {}'.format(i, len(cluster_map[i]), cluster_map[i]), '\n')

I hope that helps! I'm happy to follow up if you try to add this and get stuck...

from pix-plot.

duhaime avatar duhaime commented on August 26, 2024

@AGrosserHH I'm going to close this issue for now, but please feel free to follow up if you have any troubles!

from pix-plot.

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.