Skip to content

add upsampling parameter #1106 #1123

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 2 commits into from
Apr 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion segmentation_models_pytorch/decoders/segformer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Segformer(SegmentationModel):
activation: An activation function to apply after the final convolution layer.
Available options are **"sigmoid"**, **"softmax"**, **"logsoftmax"**, **"tanh"**, **"identity"**,
**callable** and **None**. Default is **None**.
upsampling: A number to upsample the output of the model, default is 4 (same size as input)
aux_params: Dictionary with parameters of the auxiliary output (classification head). Auxiliary output is build
on top of encoder if **aux_params** is not **None** (default). Supported params:
- classes (int): A number of classes
Expand Down Expand Up @@ -56,6 +57,7 @@ def __init__(
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],
):
Expand All @@ -80,7 +82,7 @@ def __init__(
out_channels=classes,
activation=activation,
kernel_size=1,
upsampling=4,
upsampling=upsampling,
)

if aux_params is not None:
Expand Down
Loading