Skip to content

Commit bd7f877

Browse files
authored
Add create model to docs (#883)
1 parent 3d6da1d commit bd7f877

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/quickstart.rst

+13
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ Segmentation model is just a PyTorch nn.Module, which can be created as easy as:
2020
- Check the table with :doc:`available ported encoders and its corresponding weights <encoders>`.
2121
- `Pytorch Image Models (timm) <https://github.com/huggingface/pytorch-image-models>`_ encoders are also supported, check it :doc:`here<encoders_timm>`.
2222

23+
Alternatively, you can use `smp.create_model` function to create a model by name:
24+
25+
.. code-block:: python
26+
27+
model = smp.create_model(
28+
arch="fpn", # name of the architecture, e.g. 'Unet'/ 'FPN' / etc. Case INsensitive!
29+
encoder_name="mit_b0",
30+
encoder_weights="imagenet",
31+
in_channels=1,
32+
classes=3,
33+
)
34+
35+
2336
**2. Configure data preprocessing**
2437

2538
All encoders have pretrained weights. Preparing your data the same way as during weights pre-training may give your better results (higher metric score and faster convergence). But it is relevant only for 1-2-3-channels images and **not necessary** in case you train the whole model, not only decoder.

0 commit comments

Comments
 (0)