SPOClab-ca / dn3

The fusion of MNE and PyTorch for accelerated deep-neural-network based BCI-systems and Neurophysiology signal analysis.
BSD 3-Clause "New" or "Revised" License
65 stars 19 forks source link

BENDRClassifier Error #73

Open Ctsap opened 3 years ago

Ctsap commented 3 years ago

Hello, I'm trying to follow the basic.ipynb walkthrough with the use of BENDR model provided from the bendr branch . The problem is on the process.fit() method and more specifically, on models.py line 116:

def forward(self, *x):
        features = self.features_forward(*x)
        if self.return_features:
            return self.classifier_forward(features), features
        else:
            return self.classifier_forward(features)

By adding the .t() pytorch method on the

return self.classifier_forward(features.t()), features

the error seems to be solved. I believe this may occur somewhere else also.

Moreover, the BENDR model seems to not apply the batch size configuration from .yml file. I set a batch size of 4 and an error occured. When setting to 11 (magic number) the model is training.

Thank you in advance for your time and the incorporation of BENDR on dn3 library!

kostasde commented 2 years ago

Yup, those are some strange errors... Thanks for bringing this to my attention. I've managed to use this module without problems before somehow, but despite that there was a blatant bug in the BENDRClassifier code.

I think I've fixed it now in the attached PR, but it doesn't explain how you get it working with the magic number...

Would you mind running the following test before I merge (from within dn3/tests) python3 -m unittest testTrainables.TestIncludedModels