-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tensorboard projector for contrastive learning for embedding visualization #217
base: main
Are you sure you want to change the base?
Conversation
… with UMAP,TSNE, PCA/
labels = torch.cat((indices, indices)) | ||
# Note: we assume the two augmented views are the anchor and positive samples | ||
embeddings = torch.cat((anchor_projection, positive_projection)) | ||
loss = self.loss_function(embeddings, labels) | ||
self._log_step_samples(batch_idx, (anchor, pos_img), "val") | ||
|
||
# Store embeddings for visualization | ||
if self.current_epoch % self.embedding_log_interval == 0 and batch_idx == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ziw-liu I was only logging the first batch and only from the validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would that always be the first time point(s) then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this will not be a representative (i.e. uniformly sampled) subset of the validation set. For example, in an infection time-lapse, all logged examples will be uninfected.
This PR adds the ability to save the embeddings and see them as a projection in tensorboard.