Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/920232796/setr-pytorch
Implementation of SETR model, Original paper: Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.
https://github.com/920232796/setr-pytorch
pytorch setr transformer transformer-segmentation
Last synced: 6 days ago
JSON representation
Implementation of SETR model, Original paper: Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers.
- Host: GitHub
- URL: https://github.com/920232796/setr-pytorch
- Owner: 920232796
- Created: 2021-01-18T07:57:40.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-08T10:54:33.000Z (almost 4 years ago)
- Last Synced: 2024-10-31T17:44:32.765Z (13 days ago)
- Topics: pytorch, setr, transformer, transformer-segmentation
- Language: Python
- Homepage:
- Size: 46 MB
- Stars: 129
- Watchers: 6
- Forks: 20
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 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
```python
from SETR.transformer_seg import SETRModel
import torchif __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 torchif __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.