Giter Site home page Giter Site logo

Comments (5)

xu-ji avatar xu-ji commented on August 15, 2024 1

Is it whole image clustering or segmentation you are interested in?

Just running data through a network will directly output the cluster probabilities for each input image (or several, if you use sub-heads). For c clusters, this is c per image for whole image clustering and c*h*w per image for segmentation. Simply argmax across the cluster dimension c to get the assigned cluster (per image or pixel). Currently the testing code in the scripts uses cluster_eval which does this as part of the accuracy evaluation.

You can write your own function to visualise these predictions in any way you like, either called during training or offline on some saved model or predictions. The MNIST visualisation in the paper was done with the save_progression flag.

So yep, all the results for unsupervised IIC were rendered without ground truth, except to determine the cluster to ground truth class mapping (i.e. the colour for each cluster). Which does not matter if you have no labels.

If there are no masks, this is the same as using masks (tensors same size as input) but set to all 1s, which is what is done for Potsdam. You could also edit the codebase for your purposes to remove masks support entirely.

from iic.

pcicales avatar pcicales commented on August 15, 2024

Apologies for not looking more closely - I noticed in this issue that the masks were used to isolate the 'stuff' in COCO. So in my case where there are no masks, I should refer to the other implementation correct?

from iic.

pcicales avatar pcicales commented on August 15, 2024

I see. I was able to get the code working for the clustering task, and will now try to do the same thing for segmentation. Just so I understand correctly, the uncertainty estimation you describe in the paper is derived from the N point estimates generated by the N sub heads? Could you explain this mathematically a bit more?

from iic.

pcicales avatar pcicales commented on August 15, 2024

Also, here is how I modified the accuracy function for anyone who wants to cluster into more groups then there are labels. It is simply the percentage of the dominant class in each cluster, weighted by the cluster size relative to the entire data set. This can also be used in cases where the number of clusters is equal to the number of classes. The code is given below:

def _acc(preds, targets, num_k, verbose=0):
  assert (isinstance(preds, torch.Tensor) and
          isinstance(targets, torch.Tensor) and
          preds.is_cuda and targets.is_cuda)

  if verbose >= 2:
    print("calling acc...")

  assert (preds.shape == targets.shape)
  assert (preds.max() < num_k and targets.max() < num_k)

  cluster_res = []
  for i in list(torch.unique(preds)):
    x_unique = targets[np.where(preds == i)].cpu().data.unique(sorted=True)
    x_unique_count = torch.stack([(targets[np.where(preds == i)].cpu().data == x_u).sum()
                                  for x_u in x_unique])
    print('Sample counts for cluster ' + str(i.item()) + ':')
    holder = []
    for j in xrange(len(x_unique)):
      counter = x_unique_count[j].item()*1.0
      tot =  x_unique_count.sum().item()*1.0
      holder.append(counter)
      if (counter / tot) > 0.8:
        print('Target class ' + str(x_unique[j].item()) + ', ' + str(x_unique_count[j].item()) + ' total, ' +
              str(100 * (counter / tot)) + '% (!!!!!)')
      else:
        print('Target class ' + str(x_unique[j].item()) +', ' + str(x_unique_count[j].item()) + ' total (' +
            str(100*(counter / tot)) + '%)')
    cluster_res.append((max(holder)/(x_unique_count.sum().item()*1.0))*((x_unique_count.sum().item()*1.0)/len(preds)))

  acc = sum(cluster_res)

  return acc

from iic.

xu-ji avatar xu-ji commented on August 15, 2024

the uncertainty estimation you describe in the paper is derived from the N point estimates generated by the N sub heads

The +- uncertainty in table 1 is just the standard deviation of accuracy of the sub-heads. To describe the range in performance.

cluster into more groups then there are labels

I think this is very similar to our "semi-supervised overclustering" setting (commands). The function we used to find the many-to-one mapping is here.

from iic.

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.