Binary file to train network


I am new to pytorch and I am trying to import binary files (matlab matrices which are images) to train a standard resnet18 with. What is the best way to do this? Is there a way to import binary files with torchvision.datasets or do I have to write my own dataloader? Is it possible to train the network with these binary files or do I have to imoprt every file and transform it to a tensor on my own?

Thanks in advance.

You could use to load the MATLAB files.
Once you have loaded them as numpy arrays, you would have to transform them to tensors via torch.from_numpy().
I would recommend to write a custom Dataset as described here for this use case.