transfer-learning

Loading pre-trained weights properly in Pytorch

Loading pre-trained weights properly in Pytorch Question: I would like to perform transfer learning by loading a pretrained vision transformer model, modify its last layer and training it with my own data. Hence, I am loading my dataset perform the typical transformation similar to the ImageNet, then, load the model, disable the grad from all …

Total answers: 1

Can't Import Pre Trained ResNet34 for U-Net Segmentation

Can't Import Pre Trained ResNet34 for U-Net Segmentation Question: I load the pre-trained ResNet34 for my downsampling path in encoder with this code from tensorflow.keras.applications import ResNet34 from tensorflow.keras.layers import Input # create the ResNet34 encoder inputs = Input(shape=(512, 512, 3)) encoder = ResNet34(include_top=False, weights=’imagenet’, input_tensor=inputs) # set encoder layers to non-trainable for layer in …

Total answers: 1

Setting ReLU inplace to 'False'

Setting ReLU inplace to 'False' Question: Below I have written code which accepts a pretrained model as argument (vgg, resnet, densenet etc) and returns the model with ReLU state as ‘False’. It is written after testing many different specific architectures. I would like to re-write it in a more compact way as this does not …

Total answers: 1

How to fine tune the last layers of neural network in target model for transfer learning?

How to fine tune the last layers of neural network in target model for transfer learning? Question: I am learning how transfer learning works using this data https://www.kaggle.com/competitions/santander-customer-satisfaction/data .. so this is my simple source model code in tensorflow. and I am saving this model import pandas as pd pd.set_option(‘display.max_rows’, None) import numpy as np …

Total answers: 1

How to manage epochs when doing Transfer Learning and Fine-tuning

How to manage epochs when doing Transfer Learning and Fine-tuning Question: I am training a ResNet50 model and I want to apply fine-tuning after the initial training. This is when I train the model without fine-tuning: # Train initial model without fine-tuning initial_epochs = 100 history = model.fit(train_set, validation_data = dev_set, epochs=initial_epochs,verbose=1, callbacks=callbacks) And this …

Total answers: 1

Transfer learning from a custom model trained with different image sizes

Transfer learning from a custom model trained with different image sizes Question: I have a custom model trained initially on VGG16 using transfer learning. However, it was initially trained on images with a smaller input size. Now, I am using images with bigger sizes, therefore I’d like to grab the first model and take advantage …

Total answers: 4

Label Smoothing in PyTorch

Label Smoothing in PyTorch Question: I’m building a ResNet-18 classification model for the Stanford Cars dataset using transfer learning. I would like to implement label smoothing to penalize overconfident predictions and improve generalization. TensorFlow has a simple keyword argument in CrossEntropyLoss. Has anyone built a similar function for PyTorch that I could plug-and-play with? Asked …

Total answers: 6