当前位置:网站首页>Semantic segmentation model base segmentation_ models_ Detailed introduction to pytorch
Semantic segmentation model base segmentation_ models_ Detailed introduction to pytorch
2022-07-08 00:45:00 【Ten thousand miles and a bright future arrived in an instant】
segmentation_models_pytorch( Later referred to as" smp) It is a high-level model base for semantic segmentation , Support 9 A semantic segmentation network ,400 Multi seat encoder , Originally, bloggers were not interested in this model library that only supports individual networks . however , In view of several competitions top All schemes use unet++(efficientnet Make encoder ), Bloggers are excited . If you want to use more and more comprehensive semantic segmentation models, it is recommended to use MMSegmentation, hold MMSegmentation As a semantic segmentation model base, you can refer to pytorch 24 hold MMSegmentation As pytorch The semantic segmentation model base uses ( The training and deployment of the model have been realized )_ A flash of hope to my blog -CSDN Blog _mmsegmentation Use MMSegmentation It is a semantic segmentation library suite launched by Shangtang technology , Belong to OpenMMLab Part of the project , There are many semantic segmentation models . Why do bloggers have such ideas ? There are two reasons , The first point :MMSegmentation The package is too perfect , As a dependent on pytorch Our model base is different in training , The free play space of users is very small ( For example, customization loss、 Custom learning rate scheduler 、 Custom data loader , Learn everything again ), This makes it difficult for bloggers to accept ; Second point :github Others given on pytorch The model library is too hip , The number of models supported is limited , Most only support 2020 Model years ago , This is right https://hpg123.blog.csdn.net/article/details/124459439 Back to the point , Next, describe smp The use and construction of .smp The project address of is :https://github.com/qubvel/segmentation_models.pytorch
install smp:
pip install segmentation-models-pytorch
1、 Basic introduction
9 A model architecture ( Including the legendary Unet):
- Unet [paper] [docs]
- Unet++ [paper] [docs]
- MAnet [paper] [docs]
- Linknet [paper] [docs]
- FPN [paper] [docs]
- PSPNet [paper] [docs]
- PAN [paper] [docs]
- DeepLabV3 [paper] [docs]
- DeepLabV3+ [paper] [docs]
113 Available encoders ( As well as from timm Of 400 Multiple encoders , All encoders have pre trained weights , To converge faster and better ): It is mainly a variety of versions of the following Networks
ResNet
ResNeXt
ResNeSt
Res2Ne(X)t
RegNet(x/y)
GERNet
SE-Net
SK-ResNe(X)t
DenseNet
Inception
EfficientNet
MobileNet
DPN
VGG
Common losses of training routine : Supported by loss As shown below ( stay segmentation_models_pytorch.losses in )
from .jaccard import JaccardLoss
from .dice import DiceLoss
from .focal import FocalLoss
from .lovasz import LovaszLoss
from .soft_bce import SoftBCEWithLogitsLoss
from .soft_ce import SoftCrossEntropyLoss
from .tversky import TverskyLoss
from .mcc import MCCLoss
Common indicators of training routine : stay segmentation_models_pytorch.metrics in
from .functional import (
get_stats,
fbeta_score,
f1_score,
iou_score,
accuracy,
precision,
recall,
sensitivity,
specificity,
balanced_accuracy,
positive_predictive_value,
negative_predictive_value,
false_negative_rate,
false_positive_rate,
false_discovery_rate,
false_omission_rate,
positive_likelihood_ratio,
negative_likelihood_ratio,
)
2、 Model construction
smp The construction of the model in is very convenient , Input decoder type , Weight type , Enter the number of channels 、 The number of output channels is enough .
import segmentation_models_pytorch as smp
model = smp.Unet(
encoder_name="resnet34", # choose encoder, e.g. mobilenet_v2 or efficientnet-b7
encoder_weights="imagenet", # use `imagenet` pre-trained weights for encoder initialization
in_channels=1, # model input channels (1 for gray-scale images, 3 for RGB, etc.)
classes=3, # model output channels (number of classes in your dataset)
)
But sometimes , The network structure needs to be modified , You can specify more detailed parameters ( Such as the depth of the network , Whether auxiliary head is needed 【 The default auxiliary headers here are classification headers 】). It should be noted that , stay unet The depth of encoder and decoder in the network stage The number must be the same (stage Medium filter num It can be modified according to the situation )
3、 The concrete structure of the model
stay smp in , All models have the following structure (encoder,decoder and segmentation_head).encoder It is controlled by transferring parameters ,decoder By specific model Class determination ( all smp Model decoder The output of is a tensor, non-existent list【 Such as pspnet The multi-scale features of , stay decoder Used before output conv It's fused 】),segmentation_head By the incoming classes determine ( It's just a simple one conv layer )
all smp Model forward The process is shown in the figure below
边栏推荐
- 华泰证券官方网站开户安全吗?
- Tapdata 的 2.0 版 ,开源的 Live Data Platform 现已发布
- 【愚公系列】2022年7月 Go教学课程 006-自动推导类型和输入输出
- SDNU_ ACM_ ICPC_ 2022_ Summer_ Practice(1~2)
- Su embedded training - Day3
- 《因果性Causality》教程,哥本哈根大学Jonas Peters讲授
- Installation and configuration of sublime Text3
- 他们齐聚 2022 ECUG Con,只为「中国技术力量」
- 华为交换机S5735S-L24T4S-QA2无法telnet远程访问
- "An excellent programmer is worth five ordinary programmers", and the gap lies in these seven key points
猜你喜欢
v-for遍历元素样式失效
接口测试进阶接口脚本使用—apipost(预/后执行脚本)
5g NR system messages
Is Zhou Hongyi, 52, still young?
“一个优秀程序员可抵五个普通程序员”,差距就在这7个关键点
SQL knowledge summary 004: Postgres terminal command summary
Malware detection method based on convolutional neural network
【愚公系列】2022年7月 Go教学课程 006-自动推导类型和输入输出
赞!idea 如何单窗口打开多个项目?
8道经典C语言指针笔试题解析
随机推荐
Cancel the down arrow of the default style of select and set the default word of select
Tencent security released the white paper on BOT Management | interpreting BOT attacks and exploring ways to protect
Stock account opening is free of charge. Is it safe to open an account on your mobile phone
fabulous! How does idea open multiple projects in a single window?
大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
Service Mesh介绍,Istio概述
How can CSDN indent the first line of a paragraph by 2 characters?
How is it most convenient to open an account for stock speculation? Is it safe to open an account on your mobile phone
股票开户免费办理佣金最低的券商,手机上开户安全吗
攻防演练中沙盘推演的4个阶段
Su embedded training - Day3
Deep dive kotlin collaboration (the end of 23): sharedflow and stateflow
【obs】Impossible to find entrance point CreateDirect3D11DeviceFromDXGIDevice
How to add automatic sorting titles in typora software?
How to learn a new technology (programming language)
【obs】Impossible to find entrance point CreateDirect3D11DeviceFromDXGIDevice
Is Zhou Hongyi, 52, still young?
Summary of weidongshan phase II course content
Summary of the third course of weidongshan
Zhou Hongqi, 52 ans, est - il encore jeune?