havakv / pycox

Survival analysis with PyTorch
BSD 2-Clause "Simplified" License
780 stars 180 forks source link

make a net based on pretrained model #136

Open mahootiha-maryam opened 2 years ago

mahootiha-maryam commented 2 years ago

Hi Havard. I have MRI images as Dataset. As I do not have a lot of datasets is it possible to load a pretrained model for segmentation purposes delete some of that pretrained model and connect it to the fully connected layers for predicting? My purpose is making the net that you give to deepsurv or logistichazard with mixture of the pretrained model and my fully connected layers.

havakv commented 1 year ago

Yes, this is possible, but there are no tools in pycox or torchtuples that will help you with this. So I would recommend just looking up how to delete some top layers in pytorch. You can create a new dataset by passing your data though this fixed network, and then then make a new model in pycox that use this dataset rather than your original. So if x_i is a picture, you get the z_i = fixed_net(x_i), and you make a model that use net(z_i). Does that make sense?