segmentation_models_pytorch库学习

segmentation_models_pytorch是一个基于PyTorch的图像分割神经网络

这个新集合由俄罗斯的程序员小哥Pavel Yakubovskiy一手打造。
github地址:https://github.com/qubvel/segmentation_models.pytorch
在这里插入图片描述
该库的主要功能是:

  1. 高级API(只需两行即可创建神经网络)

  2. 用于二分类和多类分割的7种模型架构(包括传奇的Unet)

  3. 每种架构有57种可用的编码器

  4. 所有编码器均具有预训练的权重,以实现更快更好的收敛

一、安装

PyPI version:

pip install segmentation-models-pytorch

Latest version from source:

pip install git+https://github.com/qubvel/segmentation_models.pytorch
二、使用

由于该库是基于PyTorch框架构建的,因此创建的细分模型只是一个PyTorch nn.Module,可以轻松地创建它:

import segmentation_models_pytorch as smp
model = smp.Unet()

根据任务的不同,您可以通过选择具有更少或更多参数的主干并使用预训练的权重来初始化它来更改网络体系结构:

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

更改模型中输出类的数量:

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

所有模型均具有预训练的编码器,因此您必须按照权重预训练的相同方法准备数据:

from segmentation_models_pytorch.encoders import get_preprocessing_fn
preprocess_input = get_preprocessing_fn('resnet18', pretrained='imagenet')

更加详细的请见github源码

注,还有其他优秀的库
例如https://github.com/CSAILVision/semantic-segmentation-pytorch
在这里插入图片描述
真的是学无止境啊,先star吧,再继续学习。

参考:
https://baijiahao.baidu.com/s?id=1632513555001646060&wfr=spider&for=pc
https://github.com/qubvel/segmentation_models.pytorch
https://github.com/CSAILVision/semantic-segmentation-pytorch

https://zhuanlan.zhihu.com/p/80688663
(这里面有一个实战项目)

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

机器不学习我学习

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值