Closed gmommi closed 1 year ago
I would suggest to train the refine net modules while keeping the backbone weights fixed
Thank you! I don't get why if I set these parameteres like following in refinenet.py:
I am not sure how are you loading the weights, this is how I did and its gives same weights each time model = segmentation.load_model(name="ReFineNet", transfer_weights=r"Downloads\refine\refine.pth", pre_trained_image_net = False, top_layers_trainable = False)
The pre_trained_image_net
, top_layers_trainable
are relevant when training from scratch, as far as just training the refine module with a pre-trained weights is concern, for that there is no direct implementation in the library, what you will have to do is after you load the model using the library function, set the params that you don't want to train to false
, here is an example.
segmentation = init_segmentation("binary")
model = segmentation.load_model(name="ReFineNet", transfer_weights=r"Downloads/refine/refine.pth", pre_trained_image_net = False, top_layers_trainable = False)
for param in model.parameters():
print(param.data)
# This will set layers from 0 to 161 to trainable = false and will only consider layers above 161 during update
for i, param in enumerate(model.parameters()):
if i <= 161:
param.requires_grad = False
......
.....
Hi! I'm using the weights of the model you trained on Inria to retrain a model with other aereial images. Which layers of the RefineNet should I retrain? Thank you!