I suggest you to install the package segmentation-models-pytorch then to create the same model as me with :
model = smp.Unet(encoder_name="mobilenet_v2",  encoder_weights='imagenet', activation=activation)
model.segmentation_head[0] = nn.Conv2d(16, num_classes, kernel_size=(1, 1), stride=(1, 1), bias=False) # to have one class in output