Skip to content

add regnet, res2net, resnest, sknet encoders #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 5, 2020
Merged

add regnet, res2net, resnest, sknet encoders #286

merged 6 commits into from
Dec 5, 2020

Conversation

azkalot1
Copy link
Contributor

Integrating some encoders using https://github.com/rwightman/pytorch-image-models

@azkalot1
Copy link
Contributor Author

Build fails since batchnorm in some of the encoders requires >= 2 samples in the batch.
I suggest test can be changes from

def get_sample(model_class):
    if model_class in [smp.Unet, smp.Linknet, smp.FPN, smp.PSPNet, smp.UnetPlusPlus]:
        sample = torch.ones([1, 3, 64, 64])
    elif model_class == smp.PAN:
        sample = torch.ones([2, 3, 256, 256])
    elif model_class == smp.DeepLabV3:
        sample = torch.ones([2, 3, 128, 128])
    else:
        raise ValueError("Not supported model class {}".format(model_class))
    return sample

to simply

def get_sample(model_class):
    if model_class in [smp.Unet, smp.Linknet, smp.FPN, smp.PSPNet, smp.UnetPlusPlus,  smp.PAN,  smp.DeepLabV3]:
        sample = torch.ones([2, 3, 256, 256])
    else:
        raise ValueError("Not supported model class {}".format(model_class))
    return sample

@qubvel
Copy link
Collaborator

qubvel commented Nov 26, 2020

It is better to keep sample as small as possible, because it will increase test time significantly (only cpu is available). May be it is better to add one more 'if' case.

@qubvel
Copy link
Collaborator

qubvel commented Nov 26, 2020

Or set batchnorms to eval mode :)

@azkalot1
Copy link
Contributor Author

Should I just use model.eval()?

@qubvel qubvel merged commit 89229a6 into qubvel-org:master Dec 5, 2020
@azkalot1 azkalot1 mentioned this pull request Dec 7, 2020
yuki-inaho pushed a commit to yuki-inaho/segmentation_models.pytorch that referenced this pull request Dec 11, 2020
* add regnet, res2net, resnest, sknet encoders

* fixed tests

* add raise erorr for dilated encoders in deeplabv3 and PAN

* raise correct error for encoders without dilation

* update README

* fix README
@JulienMaille
Copy link
Contributor

@azkalot1 May I ask you for feedback on the potential caveats of #373 ? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants