Open jungla88 opened 2 years ago
@jungla88 The loop index was not used because all the operations were performed on 'd' and it can be safely removed. For the 'Array index is out of bound' error, can you share the entire error stack? Also, did you download the BCI dataset from physionet?
I am not sure about the dataset, but it should come from the original website of BCI competition. Here the stack:
File "/home/lbaldini/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "/home/lbaldini/Projects/FBCNet/codes/classify/ho.py", line 373, in <module>
ho(datasetId, network, nGPU, subTorun)
File "/home/lbaldini/Projects/FBCNet/codes/classify/ho.py", line 194, in ho
fetchData(os.path.dirname(config['inDataPath']), datasetId) # Make sure that all the required data is present!
File "/home/lbaldini/Projects/FBCNet/codes/centralRepo/saveData.py", line 622, in fetchData
matToPython(
File "/home/lbaldini/Projects/FBCNet/codes/centralRepo/saveData.py", line 385, in matToPython
x = {"id": id, "data": d["data"]["eeg"][j, :, :], "label": lab}
IndexError: index 1 is out of bounds for axis 0 with size 1
My temporary workaround is to set j=0, returning a structure with shape (#channels, #time). This make all works and EEG Dataset with FBCNet do not raise any error about data.
I had the same problem. I think the issue lies in the shape of mat type data. We cannot collect all 288 experimental data when the hyperparameter event Code sets [2].
Same situation here.
The shape of d['data']['eeg']
is (1, 22, 1000)
.
I had the same problem. I think the issue lies in the shape of mat type data. We cannot collect all 288 experimental data when the hyperparameter event Code sets [2].
I agree with @xinyiccc.
After analyzing the codes at saveData.py
from line 62 like:
events = [event for event in gdf_events if event[1] in eventCode]
From the count distribution of gdf_events
, e.g. Counter({6: 288, 7: 72, 8: 72, 9: 72, 10: 72, 1: 18, 5: 9, 3: 1, 4: 1, 2: 1})
I infer that eventCode = [6]
instead of [2]
, which would cause dimension error as all of us faced.
However, changing the eventCode still raises error for s004.mat
... For other subjects, it seems fine
I have the same solution as you, but I also encountered this problem @ t170815518. Fortunately, I found the cause of the problem. The reason is that the experimental results of the fourth subject are incomplete, which leads to the fact that its four classification labels are not [7,8,9,10], but [5,6,7,8]. After I solve this problem, the code can run correctly. I hope it can also help you.
Thank you for this! @xinyiccc
@jungla88 @t170815518 @xinyiccc Thank you for helping debug this issue. I have patched the saveData.py file. Do download the latest version and share if it solves your issue.
I think there are some confusion with loop indices in this file:
Index
i
in first loop is never used (check with IDE or any linter), whilstj
goes out of bound ford[data][eeg]
(I checked only the first branch). Shapes for BCI2a dataset is the following: