Train a Unet model to outline specific objects in photos, such as tumors in medical scans or roads in satellite images
Export a trained segmentation model to ONNX and run it in a production environment outside of Python
Fine-tune a pretrained backbone on your own dataset for binary segmentation with just two lines of setup code
Requires Python 3.9+ and PyTorch, a GPU is recommended for training but inference can run on CPU.
Segmentation Models PyTorch (SMP) is a Python library for training AI models that identify specific regions in images. Image segmentation means going beyond recognizing what is in a picture and instead coloring in exactly which pixels belong to each object or category. For example, a segmentation model could outline every car, every pedestrian, and every road surface in a street photo, each in a different color. The library provides 12 ready-made neural network architectures, including Unet, Segformer, and DPT. Each of these defines a different strategy for combining a feature extractor with a decoder that produces the final pixel-by-pixel map. Users can mix and match these architectures with over 800 pretrained feature extractors, which are neural networks that have already been trained on large image datasets and can be reused to give a head start on a new task. Creating a model takes two lines of Python code. You specify the architecture, choose a pretrained backbone, set the number of input color channels, and set how many categories you want to distinguish. After that you can train the model using any standard training loop. The library also includes ready-made loss functions and accuracy metrics that are commonly used for this type of task. SMP models can be exported to ONNX format, which is a standard format for running models in production environments outside of Python. The library is compatible with HuggingFace Hub for saving and sharing trained models. The project includes Jupyter notebook examples for common tasks such as binary segmentation (finding one type of object) and multiclass segmentation (finding many types at once), as well as examples for loading and running pretrained models without any training. It is installed from PyPI, requires Python 3.9 or higher, and is released under the MIT license.
← qubvel-org on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.