-2
learn = vision_learner(dls, models.resnet18) 

In the above code snippet, I am calling a Vision Learner Resnet 18 model using FastAI and passing in a Dataloader containing my data.

I wonder if this process is performing any transfer learning within this call? As I am passing in my data to the vision learner.

It is important for the task I am carrying out that none is being performed at this stage.

M5RKED
  • 73
  • 1
  • 16

2 Answers2

0

FastAI's vision_learner has a pretrained argument designed specifically for that purpose. By default it is set to True, so in your case you would want to disable it:

learn = vision_learner(dls, models.resnet18, pretrained=False) 
Ivan
  • 34,531
  • 8
  • 55
  • 100
  • Does the pre-trained attribute not download a model pre-trained on ImageNet? For my case pre-training on an ImageNet is fine. It's Transfer learning on my particular data `dls` that I am looking to avoid. – M5RKED Jul 12 '22 at 13:42
  • What do you mean by "transfer learning"? – Ivan Jul 12 '22 at 13:53
  • Possibly a better phrased question, would be what is passing `dls` within the vision learner call doing to the retrieved model? How is it using the data within `dls`? – M5RKED Jul 12 '22 at 14:16
0

When you create a learner, which is a fastai object that combines the data and a model for training, and uses transfer learning to fine tune a pretrained model in just two lines of code:

learn = vision_learner(dls, resnet34, metrics=error_rate)
learn.fine_tune(1)

If you want to make a prediction on a new image, you can use learn.predict

If normalize and pretrained are True, this function adds a Normalization transform to the dls

Roy Awill
  • 132
  • 1
  • 13