Closed suminRoh closed 1 year ago
Hi, thanks for your interest! Figure 2 is for illustration only and not generated from real data. I would suggest you try a scatter plot with matplotlib, so you get 1608 scatter points on an x-y plane. You could try with different alpha/edge width with the plt.scatter function to fine-tune the generated figure.
Thank you for your quick response.
Are figure 1, 3, and 5 also illustrations and not generated from real data? I would like to know the method used to obtain the figure illustrating the feature distribution on the hypersphere. If you generated figure 5 from real data, do the features come from the output of main_moco_supcon_imba(stage 1) or main_lincls_imba(stage 2)?
Sumin, very nice question. Just wondering if you found the solution.
Figure 1, 3 and 5 are all from real data. The visualized features are the normalized output of the MLP. The same features are used to compute the targeted supervised contrastive loss (stage 1). For visualization, we simply train the network with the output dimension of MLP equals to 2, so that they naturally distribute on a 2-d circle.
If I apply your comment in the code, in main_moco_supcon_imba.py, the value of args.moco_dim is 2 (line 88), and final_feats, which is the return value of the model (line 410), will be the visualized features, as you mentioned. Did I understand your comment correctly?
Thank you for answering my question so well.
Yes, that's correct
Hi, thanks for your code. I have a question. I want to distribute the output of my dataset on a hypersphere, similar to Fig.2. If the shape of the output is (1608, 2), where each entry is in the form [x1, y1], [x2, y2], ..., [xn, yn] (where n ranges from 1 to 1608), do I have to plot xn and yn for 1608 data points?
Alternatively, if you have another method, could you please let me know