python图像分割模型_Segmentation models 是一个基于PyTorch的图像分割神经网络

Segmentation Models是一个基于PyTorch的图像分割库,提供了高阶API,简单创建神经网络。它包含多个模型架构,如Unet,并提供多种预训练的编码器。该库支持快速收敛,预训练权重,以及自定义输出类别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Python library with Neural Networks for Image

Segmentation based on PyTorch.

The main features of this library are:

High level API (just two lines to create neural network)

5 models architectures for binary and multi class segmentation (including legendary Unet)

46 available encoders for each architecture

All encoders have pre-trained weights for faster and better convergence

Table of content

Quick start

Since the library is built on the PyTorch framework, created segmentation model is just a PyTorch nn.Module, which can be created as easy as:

import segmentation_models_pytorch as smp

model = smp.Unet()

Depending on the task, you can change the network architecture by choosing backbones with fewer or more parameters and use pretrainded weights to initialize it:

model = smp.Unet('resnet34', encoder_weights='imagenet')

Change number of output classes in the model:

model = smp.Unet('resnet34', classes=3, activation='softmax')

All models have pretrained encoders, so you have to prepare your data the same way as during weights pretraining:

from segmentation_models_pytorch.encoders import get_preprocessing_fn

preprocess_input = get_preprocessing_fn('resnet18', pretrained='imagenet')

Examples

Training model for cars segmentation on CamVid dataset here.

Training SMP model with Catalyst (high-level framework for PyTorch), Ttach (TTA library for PyTorch) and Albumentations (fast image augmentation library) -

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值