eeyhsong / NICE-EEG

[ICLR 2024] M/EEG-based image decoding with contrastive learning. i. Propose a contrastive learning framework to align image and eeg. ii. Resolving brain activity for biological plausibility.
https://arxiv.org/abs/2308.13234
MIT License
85 stars 15 forks source link

How to get classification results in Figure.3? #8

Open az-justin opened 4 months ago

az-justin commented 4 months ago

Hello @eeyhsong, I have some question as below when I have finished all steps according to Readme file. Now, i want to get the classification results as shown in Figure.3 in the paper, but when i run draw_pic/plot_topk.py , appearing this bug: Traceback (most recent call last): File "D:\NICE-EEG-main\draw_pic\plot_topk.py", line 9, in y_pred = np.load('D:/NICE-EEG-main/pic/y_pred/sub%d_pred.npy' % sub_idx) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Anaconda3\envs\eeg\Lib\site-packages\numpy\lib\npyio.py", line 427, in load fid = stack.enter_context(open(os_fspath(file), "rb")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'D:/NICE-EEG-main/pic/y_pred/sub1_pred.npy'

I do not find the y_pred file and sub1_pred.npy file after training, could you tell me how to get them?

eeyhsong commented 4 months ago

Hello @az-justin, you can use the code below after the test part, saving the indices of _, indices = similarity.topk(5).

np.save('./pic/y_pred/sub' + str(self.nSub) + '_pred.npy', indices.cpu().numpy())

Best~

az-justin commented 4 months ago

Thanks soooo much @eeyhsong.