Transfer learning on 3d data


I am wondering can I use pre-trained models (2d) like that order?

Pretrainedmodel- 3dconv-3dconv etc

nn.Conv3d expects an input in the shape [batch_size, channels, depth, height, width], so you would need to reshape the output of the pretrained model to this shape.
Depending which model you are using, it might already provide the desired shape or you would need to figure out how this should be done.

E.g. if you are using a model for a multi-class classification, such as Resnet50, your output would have the shape [batch_size, nb_classes] and would contain the logits for each class.
While you might be able to reshape this output to a 5-dim tensor, it might not yield a good performance, as the nb_classes dimension containing the logits wouldn’t have any volumetric information.
In that case you could remove the last classification layer and use the output features, which would have the shape [batch_size, channels, height, width]. While the depth dimension would still be missing, I assume you have an idea how to create it.

1 Like