BiSeNet V2

Abstract:

low-level details and high-level semantics 对语义分割任务是十分重要的。为了提升模型的推理速度,当前的方法会 sacrifice the low-level details,并导致准确率的减少。为了achieve high accuracy and high efficiency ,我们提出将spatial details and categorical semantics 分开处理
Detail Branch:wide channels and shallow layers 捕获 low-level details and 生成high-resolution feature representation。
Semantic Branch:narrow channels and deep layers 获得 high-level semantic context。需要获得大的感受野捕获语义上下文信息,由于减少了通道数 and fast-downsampling 策略,该分支是轻量级的。
而且,还设计了Guided Aggregation Layer 来聚合特征
结果: 2,048×1,024 input, we achieve 72.6% Mean IoU on the Cityscapes test set with a speed of 156 FPS on one NVIDIA GeForce GTX 1080 Ti card.

Introduction

在这里插入图片描述
一些方法的高准确率依赖于骨干网络,主要有 2 种结构:
1)Dilation Backbone:去除下采样和上采样与之相关的卷积核,来保持高分辨率的特征图。
2)编解码:自top-down和skip connections 来恢复解码部分中的高分辨率特征图。
然而,这些结构是为了语义分割任务设计的,没有考虑 inference speed and computational cost.
Dilation Backbone中的空洞卷积 time-consuming and 移除了下采样,会带来繁重的 computation complexity and memory footprint. 编码-解码器结构中的大量连接对内存访问成本不太友好.
加速模型的 2 种方法:
1)input限制。
2)channel修减。
但牺牲了low-level details and spatial capacity.

方法:

3.1 Detail Branch(多的通道,浅的网络 with 小感受野 for spatial details)
Detail Branch 是为了捕获low-level spatial details。因此需要的 rich 的通道编码空间信息。因为该分支只关注 low-level details,我们设计了 一个浅的结构带有 small stride。因为该分支有大的空间size和wide channels ,不适合采用残差连接,会增加cost 减少 speed。
3.2 Semantic Branch (少的通道,深的网络 with 大感受野 for 语义类别)
该分支被设计为捕获high-level semantics。该分支有low channel capacity。SB分支的通道数是DB分支通道数的λ比率(<1)。同时采用fast-downsampling 提高了特征表达,和快速扩大感受野。高等级的语义需要大的感受野。然后该分支采用GAP得到 global contextual response。
3.3 Aggregation Layer
两分支的特征是互补的。由于SB分支的快速下采样策略,使SB分支的输出尺寸小于DB分支。我们需要上采样到相同尺寸。有许多融合信息的方式summation,concatenation and well-designed operations。考虑到精度和效率,我们做了许多实验,最终采用 bidirectional aggregation method(双向聚合的方法)
在这里插入图片描述
BiSeNet V2网络结构
在这里插入图片描述
SB分支中的Stem 、CE模块
在这里插入图片描述
Stem:它使用两种不同的向下采样方式来缩小特征表示。然后将两个分支的输出特性连接起来作为输出。该结构具有高效的计算代价和有效的特征表达能力。
CE:SB分支需要大的感受野来捕获高等级的语义信息。设计了CE模块,使用GAP和残差连接来增强全局上下文信息。
在这里插入图片描述
GE模块:(a)是mobilenet v2 (b,c)是GE模块,(b)s=1; © s =2.
在这里插入图片描述
Booster Training Strategy
在这里插入图片描述

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
下面是使用 BiSeNet V2 实现图像分割的一个简单示例: 1. 首先,需要准备数据集。可以使用常见的图像分割数据集,如 Cityscapes、PASCAL VOC、ADE20K 等。 2. 然后,需要下载 BiSeNet V2 的预训练模型。可以从官方 Github 仓库下载,链接为 https://github.com/CoinCheung/BiSeNet/tree/v2。 3. 接下来,需要对数据集进行预处理。可以使用常见的图像预处理方法,如裁剪、缩放、旋转、翻转等。此外,还需要将标签图像转换为 one-hot 编码。 4. 然后,需要加载预训练模型,并根据需要进行微调。可以使用 PyTorch 或 TensorFlow 等深度学习框架来实现。 5. 最后,可以使用模型对测试图像进行分割,并将分割结果保存为图像。 下面是一个简单的 Python 代码示例,展示了如何使用 BiSeNet V2 实现图像分割: ```python import torch import torchvision.transforms as transforms from PIL import Image import numpy as np # 加载预训练模型 model = torch.load('path/to/bisenetv2.pt') # 图像预处理 transform = transforms.Compose([ transforms.Resize((512, 512)), transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) ]) # 加载测试图像 image = Image.open('path/to/test_image.jpg') image = transform(image) image = image.unsqueeze(0) # 模型推理 with torch.no_grad(): output = model(image) # 将输出转为 Numpy 数组 output = output.squeeze(0).cpu().numpy() output = np.argmax(output, axis=0) # 将输出保存为图像 output = Image.fromarray(output.astype(np.uint8)) output.save('path/to/output.png') ``` 需要注意的是,上述代码示例仅供参考,实际应用中可能需要根据具体情况进行修改。此外,还需要对数据集、模型参数等进行调整和优化,以实现更好的分割效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值