facebookresearch / vissl

VISSL is FAIR's library of extensible, modular and scalable components for SOTA Self-Supervised Learning with images.
https://vissl.ai
MIT License
3.26k stars 334 forks source link

Extract_cluster from DeepCluster_V2 pretrained model and visualisation (#364) #417

Closed DC95 closed 3 years ago

DC95 commented 3 years ago

Summary:

For DC_V2 Cluster_assignment_extraction + visualisation_yaml_config

This PR introduces:

  1. Changes in the trainer_main.py and base_ssl_model.py to adjust the head configuration of DC_V2
  2. Yaml file config to extract clusters from the DC_V2 train checkpoint.

My own doubts -

Forgive me for my mistakes; I don't feel confident whether changing -

  1. prototype_index[idx].item() to prototype_index.item() is doing the correct job in base_sslmodel.py. I changed it because it was otherwise showing the error - 'IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number'_
  2. I also understand that in DC_V2, we use multi clustering, and for that we there are multi heads (i.e., len(self.heads) >1).

This is as far as my understanding goes. Kindly improve it as I am in urgent need of the visualization of the DCV2 Cluster assignments.

Regards, DC

Kind note - Rest we can proceed with cluster_assignments_to_dataset.py as given in the link

Interested parties

CC: @QuentinDuval, @iseessel

facebook-github-bot commented 3 years ago

Hi @DC95!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

facebook-github-bot commented 3 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

iseessel commented 3 years ago

Is this PR still needed? @DC95 I know we resolved the issue of saving the deepcluster clusters.

DC95 commented 3 years ago

we can close this @iseessel