luizgh / sigver

Signature verification package, for learning representations from signature data, training user-dependent classifiers.
BSD 3-Clause "New" or "Revised" License
82 stars 46 forks source link

Expected more than 1 value per channel when training, got input size torch.Size([1, 2048]) #10

Closed Tonyu closed 5 years ago

Tonyu commented 5 years ago

try to run this project , like this: /projects/projectS/sigver/sigver/featurelearning/train.py --model signet --logdir ./../../npz --dataset-path /projects/projectS/sigver/npz/mcyt_170_242.npz --users 0 100 --epochs 10

has some problem:

Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1596, in globals = debugger.run(setup['file'], None, None, is_module) File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 974, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/projects/projectS/sigver/sigver/featurelearning/train.py", line 427, in main(arguments) File "/projects/projectS/sigver/sigver/featurelearning/train.py", line 368, in main device, logger, args, logdir) File "/projects/projectS/sigver/sigver/featurelearning/train.py", line 83, in train val_metrics = test(val_loader, base_model, classification_layer, device, args.forg, forg_layer) File "/projects/projectS/sigver/sigver/featurelearning/train.py", line 282, in test features = base_model(x) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, kwargs) File "/projects/projectS/sigver/sigver/featurelearning/models/signet.py", line 32, in forward x = self.fc_layers(x) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, *kwargs) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/container.py", line 92, in forward input = module(input) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(input, kwargs) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/container.py", line 92, in forward input = module(input) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.6/site-packages/torch/nn/modules/batchnorm.py", line 76, in forward exponential_average_factor, self.eps) File "/usr/local/lib/python3.6/site-packages/torch/nn/functional.py", line 1619, in batch_norm raise ValueError('Expected more than 1 value per channel when training, got input size {}'.format(size)) ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 2048])

luizgh commented 5 years ago

@Tonyu what is the shape of your dataset? Note that the models were trained with grayscale images (1 channel)

Tonyu commented 5 years ago

@luizgh I think I used RGB format database. Thank you very much.