Train 3D Networks with Pytorch

Hi all,

Can I train 3D networks (such as C3D, V2V) with Pytorch?
How can I generate 5D tensor (batch, channel, length, height, width) from image sequences for the network?
Could you please show me some examples?

Thank you in advance.

Yes, we support that. You can find modules like Conv3d and pooling for volumes. I don’t understand the question about generating batches, you need to write your own Dataset that will load and return 4D elements from __getitem__. Then use a DataLoader to load the data (you can give it a batch_size argument, and it will batch the 4D elements into a 5D tensor for you).

1 Like

Thanks. Do you support Deconv3D?

1 Like

Yes. Look for ConvTranspose3d.

1 Like

The return 4D elements is (c,d,h,w) ?

The return is a tuple of 5 elements (N, c, d, h, w).

Link to the documentation: http://pytorch.org/docs/nn.html#convtranspose3d

You need to return 4D elements from the dataset, so they will be concatenated into 5D batches. Then, we only support batch mode in nn, so you’ll be using 5D tensors throught the network.

Sorry, I means that the function getitem return the dim of elements, when I write the Dataset.

As I said, __getitem__ should return 4D elements, because the DataLoader will concatenate them into a 5D batch.