AlessioGalluccio / FastFlow

an implementation of the architecture of FastFlow (Jiawei Yu et al.)
MIT License
40 stars 13 forks source link

RuntimeError: shape '[-1, 32, 262144]' is invalid for input of size 792723456 #7

Closed QQR1 closed 2 years ago

QQR1 commented 2 years ago

Traceback (most recent call last): File "/snap/pycharm-community/261/plugins/python-ce/helpers/pydev/pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/snap/pycharm-community/261/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/hzf/QLING/code/FastFlow/main.py", line 31, in model = train(train_loader, test_loader) File "/home/hzf/QLING/code/FastFlow/train.py", line 128, in train z_grouped = torch.cat(test_z, dim=0).view(-1, c.n_transforms_test, c.n_feat)

The error occured in this code:


        is_anomaly = np.array([0 if l == 0 else 1 for l in test_labels])
        z_grouped = torch.cat(test_z, dim=0).view(-1, c.n_transforms_test, c.n_feat)```
I set the dataloder params as follows:
`n_transforms = 4 # number of transformations per sample in training
n_transforms_test = 32 # number of transformations per sample in testing
batch_size = 8 # `
`test_z` shape is (42, 32, 64, 96, 96)
AlessioGalluccio commented 2 years ago

Hi @QQR1 , thanks for the remark. I'll try to solve the issue as soon as possible. Best, Alessio

AlessioGalluccio commented 2 years ago

@QQR1 which feature extractor have you used? I tried to replicate your error, but with extractor_name = "deit" in config.py, I had no issues. Best, Alessio

QQR1 commented 2 years ago

@AlessioGalluccio When I updated the code, the bug was fixed. Thank you very much