dakkoong commited on
Commit
1536bf2
1 Parent(s): 83987c9
Files changed (6) hide show
  1. .gitattributes +3 -11
  2. README.md +72 -9
  3. config.json +110 -0
  4. preprocessor_config.json +18 -0
  5. pytorch_model.bin +3 -0
  6. tf_model.h5 +3 -0
.gitattributes CHANGED
@@ -1,35 +1,27 @@
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.arrow filter=lfs diff=lfs merge=lfs -text
3
  *.bin filter=lfs diff=lfs merge=lfs -text
 
4
  *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
  *.ftz filter=lfs diff=lfs merge=lfs -text
7
  *.gz filter=lfs diff=lfs merge=lfs -text
8
  *.h5 filter=lfs diff=lfs merge=lfs -text
9
  *.joblib filter=lfs diff=lfs merge=lfs -text
10
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
  *.model filter=lfs diff=lfs merge=lfs -text
13
  *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
  *.onnx filter=lfs diff=lfs merge=lfs -text
17
  *.ot filter=lfs diff=lfs merge=lfs -text
18
  *.parquet filter=lfs diff=lfs merge=lfs -text
19
  *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
  *.pt filter=lfs diff=lfs merge=lfs -text
23
  *.pth filter=lfs diff=lfs merge=lfs -text
24
  *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
  *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
  *.tflite filter=lfs diff=lfs merge=lfs -text
30
  *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
  *.xz filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.arrow filter=lfs diff=lfs merge=lfs -text
3
  *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
  *.bz2 filter=lfs diff=lfs merge=lfs -text
 
6
  *.ftz filter=lfs diff=lfs merge=lfs -text
7
  *.gz filter=lfs diff=lfs merge=lfs -text
8
  *.h5 filter=lfs diff=lfs merge=lfs -text
9
  *.joblib filter=lfs diff=lfs merge=lfs -text
10
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
 
11
  *.model filter=lfs diff=lfs merge=lfs -text
12
  *.msgpack filter=lfs diff=lfs merge=lfs -text
 
 
13
  *.onnx filter=lfs diff=lfs merge=lfs -text
14
  *.ot filter=lfs diff=lfs merge=lfs -text
15
  *.parquet filter=lfs diff=lfs merge=lfs -text
16
  *.pb filter=lfs diff=lfs merge=lfs -text
 
 
17
  *.pt filter=lfs diff=lfs merge=lfs -text
18
  *.pth filter=lfs diff=lfs merge=lfs -text
19
  *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
 
21
  *.tar.* filter=lfs diff=lfs merge=lfs -text
 
22
  *.tflite filter=lfs diff=lfs merge=lfs -text
23
  *.tgz filter=lfs diff=lfs merge=lfs -text
 
24
  *.xz filter=lfs diff=lfs merge=lfs -text
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,12 +1,75 @@
1
  ---
2
- title: Homework2
3
- emoji: 😻
4
- colorFrom: gray
5
- colorTo: yellow
6
- sdk: gradio
7
- sdk_version: 4.2.0
8
- app_file: app.py
9
- pinned: false
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: other
3
+ tags:
4
+ - vision
5
+ - image-segmentation
6
+ datasets:
7
+ - cityscapes
8
+ widget:
9
+ - src: https://cdn-media.huggingface.co/Inference-API/Sample-results-on-the-Cityscapes-dataset-The-above-images-show-how-our-method-can-handle.png
10
+ example_title: Road
11
  ---
12
 
13
+ # SegFormer (b1-sized) model fine-tuned on CityScapes
14
+
15
+ SegFormer model fine-tuned on CityScapes at resolution 1024x1024. It was introduced in the paper [SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers](https://arxiv.org/abs/2105.15203) by Xie et al. and first released in [this repository](https://github.com/NVlabs/SegFormer).
16
+
17
+ Disclaimer: The team releasing SegFormer did not write a model card for this model so this model card has been written by the Hugging Face team.
18
+
19
+ ## Model description
20
+
21
+ SegFormer consists of a hierarchical Transformer encoder and a lightweight all-MLP decode head to achieve great results on semantic segmentation benchmarks such as ADE20K and Cityscapes. The hierarchical Transformer is first pre-trained on ImageNet-1k, after which a decode head is added and fine-tuned altogether on a downstream dataset.
22
+
23
+ ## Intended uses & limitations
24
+
25
+ You can use the raw model for semantic segmentation. See the [model hub](https://huggingface.co/models?other=segformer) to look for fine-tuned versions on a task that interests you.
26
+
27
+ ### How to use
28
+
29
+ Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
30
+
31
+ ```python
32
+ from transformers import SegformerFeatureExtractor, SegformerForSemanticSegmentation
33
+ from PIL import Image
34
+ import requests
35
+
36
+ feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-b1-finetuned-cityscapes-1024-1024")
37
+ model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b1-finetuned-cityscapes-1024-1024")
38
+
39
+ url = "http://images.cocodataset.org/val2017/000000039769.jpg"
40
+ image = Image.open(requests.get(url, stream=True).raw)
41
+
42
+ inputs = feature_extractor(images=image, return_tensors="pt")
43
+ outputs = model(**inputs)
44
+ logits = outputs.logits # shape (batch_size, num_labels, height/4, width/4)
45
+ ```
46
+
47
+ For more code examples, we refer to the [documentation](https://huggingface.co/transformers/model_doc/segformer.html#).
48
+
49
+ ### License
50
+
51
+ The license for this model can be found [here](https://github.com/NVlabs/SegFormer/blob/master/LICENSE).
52
+
53
+ ### BibTeX entry and citation info
54
+
55
+ ```bibtex
56
+ @article{DBLP:journals/corr/abs-2105-15203,
57
+ author = {Enze Xie and
58
+ Wenhai Wang and
59
+ Zhiding Yu and
60
+ Anima Anandkumar and
61
+ Jose M. Alvarez and
62
+ Ping Luo},
63
+ title = {SegFormer: Simple and Efficient Design for Semantic Segmentation with
64
+ Transformers},
65
+ journal = {CoRR},
66
+ volume = {abs/2105.15203},
67
+ year = {2021},
68
+ url = {https://arxiv.org/abs/2105.15203},
69
+ eprinttype = {arXiv},
70
+ eprint = {2105.15203},
71
+ timestamp = {Wed, 02 Jun 2021 11:46:42 +0200},
72
+ biburl = {https://dblp.org/rec/journals/corr/abs-2105-15203.bib},
73
+ bibsource = {dblp computer science bibliography, https://dblp.org}
74
+ }
75
+ ```
config.json ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "SegformerForSemanticSegmentation"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.0,
6
+ "classifier_dropout_prob": 0.1,
7
+ "decoder_hidden_size": 256,
8
+ "depths": [
9
+ 2,
10
+ 2,
11
+ 2,
12
+ 2
13
+ ],
14
+ "downsampling_rates": [
15
+ 1,
16
+ 4,
17
+ 8,
18
+ 16
19
+ ],
20
+ "drop_path_rate": 0.1,
21
+ "hidden_act": "gelu",
22
+ "hidden_dropout_prob": 0.0,
23
+ "hidden_sizes": [
24
+ 64,
25
+ 128,
26
+ 320,
27
+ 512
28
+ ],
29
+ "id2label": {
30
+ "0": "road",
31
+ "1": "sidewalk",
32
+ "2": "building",
33
+ "3": "wall",
34
+ "4": "fence",
35
+ "5": "pole",
36
+ "6": "traffic light",
37
+ "7": "traffic sign",
38
+ "8": "vegetation",
39
+ "9": "terrain",
40
+ "10": "sky",
41
+ "11": "person",
42
+ "12": "rider",
43
+ "13": "car",
44
+ "14": "truck",
45
+ "15": "bus",
46
+ "16": "train",
47
+ "17": "motorcycle",
48
+ "18": "bicycle"
49
+ },
50
+ "image_size": 224,
51
+ "initializer_range": 0.02,
52
+ "label2id": {
53
+ "bicycle": 18,
54
+ "building": 2,
55
+ "bus": 15,
56
+ "car": 13,
57
+ "fence": 4,
58
+ "motorcycle": 17,
59
+ "person": 11,
60
+ "pole": 5,
61
+ "rider": 12,
62
+ "road": 0,
63
+ "sidewalk": 1,
64
+ "sky": 10,
65
+ "terrain": 9,
66
+ "traffic light": 6,
67
+ "traffic sign": 7,
68
+ "train": 16,
69
+ "truck": 14,
70
+ "vegetation": 8,
71
+ "wall": 3
72
+ },
73
+ "layer_norm_eps": 1e-06,
74
+ "mlp_ratios": [
75
+ 4,
76
+ 4,
77
+ 4,
78
+ 4
79
+ ],
80
+ "model_type": "segformer",
81
+ "num_attention_heads": [
82
+ 1,
83
+ 2,
84
+ 5,
85
+ 8
86
+ ],
87
+ "num_channels": 3,
88
+ "num_encoder_blocks": 4,
89
+ "patch_sizes": [
90
+ 7,
91
+ 3,
92
+ 3,
93
+ 3
94
+ ],
95
+ "reshape_last_stage": true,
96
+ "sr_ratios": [
97
+ 8,
98
+ 4,
99
+ 2,
100
+ 1
101
+ ],
102
+ "strides": [
103
+ 4,
104
+ 2,
105
+ 2,
106
+ 2
107
+ ],
108
+ "torch_dtype": "float32",
109
+ "transformers_version": "4.12.0.dev0"
110
+ }
preprocessor_config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "do_resize": true,
4
+ "feature_extractor_type": "SegformerFeatureExtractor",
5
+ "image_mean": [
6
+ 0.485,
7
+ 0.456,
8
+ 0.406
9
+ ],
10
+ "image_std": [
11
+ 0.229,
12
+ 0.224,
13
+ 0.225
14
+ ],
15
+ "reduce_labels": false,
16
+ "resample": 2,
17
+ "size": 1024
18
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a7c40538e41d92f93ad6501d54e6333833a1d96bda7b0906c7255240e927832
3
+ size 54810145
tf_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27a35d0c9e60f4b22d61048dcdce7f7b0b2d9b10ad60da852ace2b4ccf541bfe
3
+ size 55007948