Skip to content

KeyError when using Segformer architecture in segmentation_models_pytorch #1019

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

Closed
essawey opened this issue Jan 2, 2025 · 6 comments
Closed

Comments

@essawey
Copy link

essawey commented Jan 2, 2025

Description:

I encountered an error while trying to use the "Segformer" architecture in segmentation_models_pytorch as shown below:

import segmentation_models_pytorch as smp
model = smp.create_model(arch="Segformer")

Error:
KeyError: "Wrong architecture type Segformer. Available options are: ['unet', 'unetplusplus', 'manet', 'linknet', 'fpn', 'pspnet', 'deeplabv3', 'deeplabv3plus', 'pan']"

It appears that the "Segformer" architecture is not linked to the library. Based on the error message, only the listed architectures are currently available for use.

Environment:

segmentation_models_pytorch version: 0.3.4
Python version: 3.8

I believe the architecture might not be integrated into the library yet.
Please let me know if there are any updates regarding this,
if there’s another way to use Segformer with this library.

Thanks <3

@qubvel
Copy link
Collaborator

qubvel commented Jan 2, 2025

Hey! Segformer is not yet in the release, please install from source. The release planned in a week

@essawey essawey closed this as completed Jan 2, 2025
@Alberto1404
Copy link

Alberto1404 commented Feb 28, 2025

Hey @qubvel, so great work with this repository!
I was wondering about the posibility to use the segformer with original weights from Nvidia, calling create_model directly.
Moreover, I attempted to finetune the Segformer in a custom dataset for binary segmentation, but it is somehow not taking the ignore_mismatched_sizes = True argument.
Perhaps it is not implemented? Or is it not expected to do that?
Thank you in advance!!

@qubvel
Copy link
Collaborator

qubvel commented Feb 28, 2025

Hi @Alberto1404, thanks for reporting this! Yes, it's not implemented yet, but it would be great to have this option! The feature should be fairly simple to implement. Let me know if you have the bandwidth to contribute, otherwise, I will take care of it 🤗

@Alberto1404
Copy link

Hi @qubvel, I attempted to spend some time during weekend, as the following days I won't be able to do anything. If you don't mind taking care of it, I will be highly appreciated.
Thank you

@qubvel
Copy link
Collaborator

qubvel commented Mar 26, 2025

Hey @Alberto1404, the PR is up

@Alberto1404
Copy link

Awesome!

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

No branches or pull requests

3 participants