Generating t-SNE plot
Closed this issue · 2 comments
Dear authors,
Thanks for providing LIMU-BERT with us!
I followed the instructions provided and tried to generate the t-SNE plots for general IMU representations learned in the first unsupervised phase.
To replicate my issue:
I first docker run the container I provided earlier in README
In the root dir in this repo LIMU-BERT-Public
, I ran the pretrain script and trained the model for 3200 epochs:
python pretrain.py v1 uci 20_120 -s limu_v1
Then I added plt.savefig('tsne.png')
in the plot_tsne()
method in
Line 48 in 5d63a7a
uncommented the following 3 lines of code
# label_index = 1
# label_names, label_num = load_dataset_label_names(args.dataset_cfg, label_index)
# data_tsne, labels_tsne = plot_embedding(output, labels, label_index=label_index, reduce=1000, label_names=label_names)
in https://github.com/dapowan/LIMU-BERT-Public/blob/master/embedding.py#L66-L68 so that it can plot the embeddings.
One extra step is to manually create the directory embed
under the root path of this repo, e.g. by
mkdir embed
otherwise I got
cuda:0 (1 GPUs)
Loading the model from saved/pretrain_base_uci_20_120/limu_v1
Traceback (most recent call last):
File "embedding.py", line 64, in <module>
data, output, labels = generate_embedding_or_output(args=args, output_embed=True, save=save)
File "embedding.py", line 48, in generate_embedding_or_output
np.save(os.path.join('embed', save_name + '.npy'), output)
File "<__array_function__ internals>", line 6, in save
File "/usr/local/lib/python3.6/dist-packages/numpy/lib/npyio.py", line 524, in save
file_ctx = open(file, "wb")
FileNotFoundError: [Errno 2] No such file or directory: 'embed/embed_limu_v1_uci_20_120.npy'
Then I ran:
python embedding.py v1 uci 20_120 -f limu_v1
However, what I got from the tsne.png
is:
It seems that the labels here are not human activity labels.
It would be appreciated if you can help. Thanks!
Hi Bryan, as described in dataset\dataset_config.json, the activity label index of the UCI dataset is 0 instead of 1. So try label_index = 0 and re-run the experiment.