I do not load images directly, as most tutorials show. I load numpy arrays from an hdf5 file that are indeed images itself.
Since I was using Keras, the dimensions order of my numpy arrays are (B,W,H,C). I switched the dimensions W and C, since this is the order PyTorch uses, right (B, C, H, W)?
X_train = torch.from_numpy(np.array(np.rollaxis(X_train, 3, 1), dtype=np.dtype(“d”)))
This is the code I’m using to obtain the PyTorch tensor. I’m totally new to this library and have no idea on how to normalize this PyTorch tensor, whereas all tutorials use the normalize together with other things that are not suitable to my problem.
Thanks!
Edi: Trying to run this code, even without normalization, I faced an error “RuntimeError: Expected object of scalar type Double but got scalar type Float” in the line :
outputs = model(inputs)
of the function train_model() in the tutorial https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html 45