MousaviSajad / SleepEEGNet

SleepEEGNet: Automated Sleep Stage Scoring with Sequence to Sequence Deep Learning Approach
200 stars 72 forks source link

ValueError: need at least one array to concatenate #15

Open AzadehGh opened 3 years ago

AzadehGh commented 3 years ago

Hello according to https://github.com/genaris/deepsleepnet I made some changes to run this code on Python 3.7. after solving some warnings about packages compatibility this error is not solved yet:

(Python f) F:\PhD\5th semester\Deep Learning\project\Python f>python seq2seq_sleep_sleep-EDF.py --data_dir data_2013/eeg_fpz_cz --output_dir output_2013 --n_folds 6 2021-02-11 14:47:47.456383

========== [Fold-0] ==========

Load training set:

Load Test set:

Training set: n_subjects=0 Number of examples = 0 Traceback (most recent call last): File "seq2seq_sleep_sleep-EDF.py", line 757, in tf.app.run() File "F:\PhD\5th semester\Deep Learning\project\Python f\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run _sys.exit(main(argv)) File "seq2seq_sleep_sleep-EDF.py", line 755, in main run_program(hparams,FLAGS) File "seq2seq_sleep_sleep-EDF.py", line 500, in run_program X_train, y_train, X_test, y_test = data_loader.load_data(seq_len=hparams.max_time_step) File "F:\PhD\5th semester\Deep Learning\project\Python f\dataloader.py", line 160, in load_data self.print_n_samples_each_class(np.hstack(label_train),self.classes) File "F:\PhD\5th semester\Deep Learning\project\Python f\lib\site-packages\numpy\core\shape_base.py", line 340, in hstack return _nx.concatenate(arrs, 1) ValueError: need at least one array to concatenate

it seems that the data is not loaded. I would appreciate if you could let me know the solution.

MousaviSajad commented 3 years ago

Hello, based on these outputs:

Training set: n_subjects=0 Number of examples = 0

There might be no files in this directory data_dir. You can debug the code and check if there are any files in the data_dir path, also you can put a breakpoint at the below line and check this. https://github.com/MousaviSajad/SleepEEGNet/blob/2fcd73c8d5c2d499fbb78300392f432c3f3b4f3e/dataloader.py#L105

Regards, Sajad

On Thu, Feb 11, 2021 at 6:30 AM AzadehGh notifications@github.com wrote:

Hello according to https://github.com/genaris/deepsleepnet I made some changes to run this code on Python 3.7. after solving some warnings about packages compatibility this error is not solved yet:

(Python f) F:\PhD\5th semester\Deep Learning\project\Python f>python seq2seq_sleep_sleep-EDF.py --data_dir data_2013/eeg_fpz_cz --output_dir output_2013 --n_folds 6 2021-02-11 14:47:47.456383

========== [Fold-0] ==========

Load training set:

Load Test set:

Training set: n_subjects=0 Number of examples = 0 Traceback (most recent call last): File "seq2seq_sleep_sleep-EDF.py", line 757, in tf.app.run() File "F:\PhD\5th semester\Deep Learning\project\Python f\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run _sys.exit(main(argv)) File "seq2seq_sleep_sleep-EDF.py", line 755, in main run_program(hparams,FLAGS) File "seq2seq_sleep_sleep-EDF.py", line 500, in run_program X_train, y_train, X_test, y_test = data_loader.load_data(seq_len=hparams.max_time_step) File "F:\PhD\5th semester\Deep Learning\project\Python f\dataloader.py", line 160, in load_data self.print_n_samples_each_class(np.hstack(label_train),self.classes) File "F:\PhD\5th semester\Deep Learning\project\Python f\lib\site-packages\numpy\core\shape_base.py", line 340, in hstack return _nx.concatenate(arrs, 1) ValueError: need at least one array to concatenate

it seems that the data is not loaded. I would appreciate if you could let me know the solution.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MousaviSajad/SleepEEGNet/issues/15, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4D7SPCUATNDE6QBT5OFYTS6O5TXANCNFSM4XOVG3OA .

AzadehGh commented 3 years ago

Hello thanks a lot for your answer. I tried using Google Colab and it is solved. but due to limited time I need to change the number of folds. I do it through this command in run as you said: python seq2seq_sleep_sleep-EDF.py --data_dir data_2013/eeg_fpz_cz --output_dir output_2013 --n_folds 20 but it was not applied. according to this line: tf.app.flags.DEFINE_integer('num_folds', 20, """Number of cross-validation folds.""") I changed the command to num_fold too, but it is not applied again. and run is stopped in fold 15 because of time and I can not get any results.

AzadehGh commented 3 years ago

Hi again I guess because the name in data loader is n_folds but in sleep_sleep_seq2seq is num_folds. shouldn't these to have the same name?

MousaviSajad commented 3 years ago

Hi, You should change n_folds to num_folds like the below line: python seq2seq_sleep_sleep-EDF.py --data_dir data_2013/eeg_fpz_cz --output_dir output_2013 --num_folds 20 or change the number of folds here https://github.com/MousaviSajad/SleepEEGNet/blob/924cce632076c39fce2b7cb081bc6d0f59c8ebb6/seq2seq_sleep_sleep-EDF.py#L729 Regards, Sajad

On Mon, Feb 15, 2021 at 10:32 PM AzadehGh notifications@github.com wrote:

Hi again I guess because the name in data loader is n_folds but in sleep_sleep_seq2seq is num_folds. shouldn't these to have the same name?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MousaviSajad/SleepEEGNet/issues/15#issuecomment-779558234, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4D7SOV4LTL6IIKX3T6SEDS7HRMLANCNFSM4XOVG3OA .

AzadehGh commented 3 years ago

Hi thanks a lot for your answer. I did both of them. but unfortunately it didn't work.

MousaviSajad commented 3 years ago

It should have worked! or to debug, you can track the value of num_folds by printing it.

Regards, Sajad

On Tue, Feb 16, 2021 at 10:20 PM AzadehGh notifications@github.com wrote:

Hi thanks a lot for your answer. I did both of them. but unfortunately it didn't work.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MousaviSajad/SleepEEGNet/issues/15#issuecomment-780269567, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4D7SMOR7SIUKJ3TB2TDVDS7MYYDANCNFSM4XOVG3OA .