TorchStudio / torchstudio

IDE for PyTorch and its ecosystem
https://torchstudio.ai
MIT License
378 stars 27 forks source link

Can't build models #16

Closed fahmanali closed 2 years ago

fahmanali commented 2 years ago

When I tried to build a model like resent or densenet I got a message: "File C:\Users\User\TorchStudio\python\lib\site-packages\torch\nn\functional.py, line 2248, in _verify_batch_size 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, 512, 1, 1])"

divideconcept commented 2 years ago

Indeed ResNet and DenseNet models expect color pictures, meaning 3D tensors with the first dimension being 3 (for the R,G,B channels). For instance if you load the CIFAR10 dataset and add a transforms.Resize(256) to make the picture big enough (have a look at this tutorial: https://torchstudio.ai/transferlearning/ ) you should be able to build the ResNet and DenseNet models just fine.

What's the exact input size of your tensors ? 512x1x1 doesn't look like a picture.

fahmanali commented 2 years ago

Thank you for your response. Done.