<img src="./SETR.png" width="800px"></img>
## SETR - Pytorch
Since the original paper (Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.) has no official code,I implemented SETR-Progressive UPsampling(SETR-PUP) using pytorch.
Original paper: <a href="https://arxiv.org/abs/2012.15840">Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.</a>
## Vit
The Vit model is also implemented, and you can use it for image classification.
## Usage SETR
```python
from SETR.transformer_seg import SETRModel
import torch
if __name__ == "__main__":
net = SETRModel(patch_size=(32, 32),
in_channels=3,
out_channels=1,
hidden_size=1024,
num_hidden_layers=8,
num_attention_heads=16,
decode_features=[512, 256, 128, 64])
t1 = torch.rand(1, 3, 256, 256)
print("input: " + str(t1.shape))
# print(net)
print("output: " + str(net(t1).shape))
```
If the output size is (1, 1, 256, 256), the code runs successfully.
## Usage Vit
```python
from SETR.transformer_seg import Vit
import torch
if __name__ == "__main__":
model = Vit(patch_size=(7, 7),
in_channels=1,
out_class=10,
hidden_size=1024,
num_hidden_layers=1,
num_attention_heads=16)
print(model)
t1 = torch.rand(1, 1, 28, 28)
print("input: " + str(t1.shape))
print("output: " + str(model(t1).shape))
```
The output shape is (1, 10).
## current examples
1. task_mnist: The simplest example, using the Vit model to classify the minst dataset.
2. task_car_seg: The example is sample segmentation task. data download: <a href="https://www.kaggle.com/c/carvana-image-masking-challenge/data">https://www.kaggle.com/c/carvana-image-masking-challenge/data</a>
## more
More examples will be updated later.
乘风破浪的海伦
- 粉丝: 33
- 资源: 4546
最新资源
- 基于知识图谱的健康养生智能知识服务系统架构设计
- 双向链表的从小到大的插入,删除,遍历,清空
- Matlab基于灰色隐马尔可夫模型(HMMP-GM11)的时间序列预测(含完整的程序,GUI设计和代码详解)
- CTF - Misc - 图片隐写 - 隐藏的钥匙.jpg
- Matlab实现LSTM多输入单输出未来碳排放预测(含完整的程序,GUI设计和代码详解)
- Controllable Image Synthesis of Industrial Data Using Stable Diffusion
- C语言课程设计(成绩管理系统)源程序
- 液晶面板打包机工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
- 可爱猫4.6内含易语言开发包含案例
- Matlab实现EVO-CNN-LSTM-Mutilhead-Attention能量谷优化算法优化卷积长短期记忆神经网络融合多头注意力机制多变量多步时间序列预测(含完整的程序,GUI设计和代码详解)
- Matlab实现MSADBO-CNN-LSTM基于改进蜣螂算法优化卷积神经网络-长短期记忆神经网络多特征回归预测(含完整的程序,GUI设计和代码详解)
- 基于C++开发的WEB服务器,支持C/C++、Python、Java等多语言混合开发WEB应用
- 一个可以工作在nginx tcp负载均衡环境中的集群聊天服务器和客户端实例源码
- 强化学习Q学习的单摆运动Matlab代码.rar
- 强化学习的N-形式化Matlab实现。比较了epsilon贪婪,强化.rar
- 气动人工肌肉驱动的机器人腿和强化学习simulink实现.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈