brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
model-buildingCreate and debug segmentation_models_pytorch model architectures, create_model calls, output shapes, auxiliary heads, and encoder freezing.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this sub-skill when the task asks to create, choose, inspect, or debug a segmentation_models_pytorch semantic segmentation model. SMP models are PyTorch torch.nn.Module objects that consume NCHW tensors and return segmentation masks, or (mask, label) when an auxiliary classification head is enabled.
smp.create_model, output contracts, and encoder freeze helpers.Unet, FPN, DeepLabV3Plus, Segformer, DPT, and the other SMP architectures.smp.Unet, smp.FPN, smp.DeepLabV3Plus, or another architecture class when the architecture is fixed in code.smp.create_model(arch="unet", encoder_name="resnet34", encoder_weights=None, in_channels=1, classes=1) for config-driven architecture selection.in_channels to the input tensor channel count and classes to the number of mask channels the model should emit.aux_params={"pooling": "avg", "classes": label_count, "dropout": 0.5, "activation": "sigmoid"} and unpack mask, label = model(x).model.freeze_encoder() before decoder-only fine-tuning and model.unfreeze_encoder() when full-model training should resume.encoder_weights=None by default before wiring the model into a training or export workflow.encoder_name discovery, pretrained preprocessing functions, and input normalization belong in Encoders And Preprocessing.import torch
import segmentation_models_pytorch as smp
model = smp.create_model(
arch="unet",
encoder_name="resnet34",
encoder_weights=None,
in_channels=1,
classes=1,
).eval()
x = torch.zeros(1, 1, 64, 64)
with torch.inference_mode():
mask = model(x)
assert tuple(mask.shape) == (1, 1, 64, 64)