You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to convert the weights from a segmentation-models-based model that was trained in TensorFlow to PyTorch. I am using a U-net with an efficientnet-b0 backbone.
I noticed a mismatch in the dimensions of the parameters across the PyTorch and and TensorFlow implementations in the convolutional layers of the decoder. What is the source of this discrepancy, and how can I make the architectures match exactly?
Reproducible example:
# set up models
# pytorch
import torch.nn
import segementation_models_pytorch as smp
from functools import partial
pytorch_model = smp.Unet('efficientnet-b0', classes=4, activation=partial(nn.Softmax, dim=0))
# tensorflow
import segmentation_models as sm
tf_model = sm.Unet('efficientnetb0', classes=4, activation='softmax', encoder_freeze=False)
Observe the mismatch in the convolutional layers of the decoder, taking the first one as an example:
I am trying to convert the weights from a
segmentation-models
-based model that was trained in TensorFlow to PyTorch. I am using a U-net with anefficientnet-b0
backbone.I noticed a mismatch in the dimensions of the parameters across the PyTorch and and TensorFlow implementations in the convolutional layers of the decoder. What is the source of this discrepancy, and how can I make the architectures match exactly?
Reproducible example:
Observe the mismatch in the convolutional layers of the decoder, taking the first one as an example:
Note how the TensorFlow version has 1952 in channels, and the PyTorch version has 432 in-channels. Why is this the case?
This is a cross-post of the issue #840 in the segmentation_models.pytorch repo.
The text was updated successfully, but these errors were encountered: