当前位置:网站首页>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
边栏推荐
- 华泰证券官方网站开户安全吗?
- 赞!idea 如何单窗口打开多个项目?
- Qt添加资源文件,为QAction添加图标,建立信号槽函数并实现
- C # generics and performance comparison
- SDNU_ ACM_ ICPC_ 2022_ Summer_ Practice(1~2)
- Qt不同类之间建立信号槽,并传递参数
- Solution to the problem of unserialize3 in the advanced web area of the attack and defense world
- 丸子官网小程序配置教程来了(附详细步骤)
- Reentrantlock fair lock source code Chapter 0
- 取消select的默认样式的向下箭头和设置select默认字样
猜你喜欢
Is Zhou Hongyi, 52, still young?
My best game based on wechat applet development
They gathered at the 2022 ecug con just for "China's technological power"
After going to ByteDance, I learned that there are so many test engineers with an annual salary of 40W?
Jouer sonar
Cancel the down arrow of the default style of select and set the default word of select
Malware detection method based on convolutional neural network
基于微信小程序开发的我最在行的小游戏
jemter分布式
An error is reported during the process of setting up ADG. Rman-03009 ora-03113
随机推荐
[programming problem] [scratch Level 2] 2019.09 make bat Challenge Game
Hotel
Prompt configure: error: required tool not found: libtool solution when configuring and installing crosstool ng tool
从Starfish OS持续对SFO的通缩消耗,长远看SFO的价值
Sqlite数据库存储目录结构邻接表的实现2-目录树的构建
深潜Kotlin协程(二十二):Flow的处理
51 communicates with the Bluetooth module, and 51 drives the Bluetooth app to light up
服务器防御DDOS的方法,杭州高防IP段103.219.39.x
去了字节跳动,才知道年薪 40w 的测试工程师有这么多?
Installation and configuration of sublime Text3
深潜Kotlin协程(二十三 完结篇):SharedFlow 和 StateFlow
华为交换机S5735S-L24T4S-QA2无法telnet远程访问
接口测试进阶接口脚本使用—apipost(预/后执行脚本)
Which securities company has a low, safe and reliable account opening commission
How to add automatic sorting titles in typora software?
Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades(KDD20)
Lecture 1: the entry node of the link in the linked list
52歲的周鴻禕,還年輕嗎?
ABAP ALV LVC模板
1293_FreeRTOS中xTaskResumeAll()接口的实现分析