qubvel-org / qubvel-org/segmentation_models.pytorch
segformer model implementation != original arch design
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.7k
- Forks
- 1.8k
- Avg merge
- 5h 42m
- Merged PRs (30d)
- 11
Description
In the segformer paper, the diagram looks like this
But in this repo, the code is written as below. How come it has encoder name attribute, there's no CNN feature extraction separately in the original design plan?
@supports_config_loading
def __init__(
self,
encoder_name: str = "resnet34",
encoder_depth: int = 5,
encoder_weights: Optional[str] = "imagenet",
decoder_segmentation_channels: int = 256,
in_channels: int = 3,
classes: int = 1,
activation: Optional[Union[str, Callable]] = None,
upsampling: int = 4,
aux_params: Optional[dict] = None,
**kwargs: dict[str, Any],
):
super().__init__()
self.encoder = get_encoder(
encoder_name,
in_channels=in_channels,
depth=encoder_depth,
weights=encoder_weights,
**kwargs,
)
self.decoder = SegformerDecoder(
encoder_channels=self.encoder.out_channels,
encoder_depth=encoder_depth,
segmentation_channels=decoder_segmentation_channels,
)
self.segmentation_head = SegmentationHead(
in_channels=decoder_segmentation_channels,
out_channels=classes,
activation=activation,
kernel_size=1,
upsampling=upsampling,
)
if aux_params is not None:
self.classification_head = ClassificationHead(
in_channels=self.encoder.out_channels[-1], **aux_params
)
else:
self.classification_head = None
self.name = "segformer-{}".format(encoder_name)
self.initialize()
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with segmentation_models_pytorch/decoders/segformer/model.py and compare its constructor, encoder setup, and decoder wiring with the SegFormer paper diagram linked in the issue. Determine whether the encoder_name and get_encoder path are intentional; document the discrepancy or identify the implementation change needed, with relevant tests updated if behavior changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100