Thanks!
I am fine tuning a pretrained model with my own data, so the second method would work for me.
One follow up question:
Wouldn’t I have to fetch the number of in_channels of the existing pre-trained model, similarly to how  its done in the example with ‘num_ftrs’?
So in the tutorial there is this line before creating a new layer:
num_ftrs = model_ft.fc.in_features
Would the equivalent for segmentation be the line below?:
in_chnls =  modelB.classifier[4].in_channels
And then:
modelB.classifier[4] = nn.Conv2d(in_chnls, num_classes, 1, 1)