• Stars
    star
    128
  • Rank 281,044 (Top 6 %)
  • Language
    Python
  • Created almost 4 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Implementation of SETR model, Original paper: Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.

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: Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.

Vit

The Vit model is also implemented, and you can use it for image classification.

Usage SETR

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

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: https://www.kaggle.com/c/carvana-image-masking-challenge/data

more

More examples will be updated later.

More Repositories

1

bert_seq2seq

pytorch实现 Bert 做seq2seq任务,使用unilm方案,现在也可以做自动摘要,文本分类,情感分析,NER,词性标注等任务,支持t5模型,支持GPT2进行文章续写。
Python
1,279
star
2

MedicalSeg

3D Medical Image Segmentation Models,集成各种医学图像分割模型的小框架,主要是3D,持续更新...
Python
67
star
3

bert_seq2seq_DDP

bert_seq2seq的DDP版本,支持bert、roberta、nezha、t5、gpt2等模型,支持seq2seq、ner、关系抽取等任务,无需添加额外代码,轻松启动DDP多卡训练。
Python
45
star
4

NestedFormer

NestedFormer: Nested Modality-Aware Transformer for Brain Tumor Segmentation (MICCAI 2022)
Python
38
star
5

MlpMixer-pytorch

Implementation of MlpMixer model, Original paper: MLP-Mixer: An all-MLP Architecture for Vision
Python
19
star
6

NLP_flask

可以将bert相关模型在网站上进行展示、测试,后端使用flask,前端使用vue。
Python
10
star
7

pytorch_chatbot

pytorch实现聊天机器人,seq2seq模型
Python
9
star
8

online_video

在线学习系统,使用vue实现,很多界面都很简单,视频那部分只用张图片就当作视频了,还有待完善~
Vue
7
star
9

pytorch-rnn_poem

使用pytorch,简单rnn模型写诗
Python
4
star
10

my_blog_vue

我的博客前端vue代码
Vue
3
star
11

my_blog_api_java

我的博客后端java spring boot 代码
Java
3
star
12

sentiment-pytorch

使用pytorch进行中文小数据情感分析
Jupyter Notebook
3
star
13

HybridMIM

The mp-ssl, a masked-region perception multi-task self supervised learning method.
2
star
14

go_socket

go语言实现的简单的socket代理,配合SwitchyOmega可以将本地浏览器的请求连接转发到别的服务器上。
Go
2
star
15

image_bed_vue

自己用vue写的的图床界面,使用element ui,下拉可以不断请求新数据。后端接收上传图片到阿里云oss。
Vue
2
star
16

my_diary_vue

笔记项目前端vue代码
Vue
1
star
17

baidu_search_api_flask

网盘搜索后端python flask代码
Python
1
star
18

my_diary_api

笔记项目后端flask代码
Python
1
star
19

onlineExercise

在线练习平台后端代码
Java
1
star