Spaces:
Runtime error
Runtime error
JinHyeong99
commited on
Commit
·
4bb02ca
1
Parent(s):
74f29d8
- README.md +19 -0
- config.json +2 -2
- preprocessor_config.json +1 -1
- pytorch_model.bin +2 -2
- tf_model.h5 +2 -2
README.md
CHANGED
@@ -9,4 +9,23 @@ app_file: app.py
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
12 |
+
```python
|
13 |
+
from transformers import SegformerFeatureExtractor, SegformerForSemanticSegmentation
|
14 |
+
from PIL import Image
|
15 |
+
import requests
|
16 |
+
|
17 |
+
feature_extractor = SegformerFeatureExtractor.from_pretrained("nvidia/segformer-b3-finetuned-cityscapes-1024-1024")
|
18 |
+
model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b3-finetuned-cityscapes-1024-1024")
|
19 |
+
|
20 |
+
url = ["https://imagescdn.gettyimagesbank.com/500/201407/a8281860.jpg",
|
21 |
+
"https://imagescdn.gettyimagesbank.com/500/14/890/614/3/a8281872.jpg",
|
22 |
+
"https://50plus.or.kr/upload/im/2019/06/d3007817-9c63-468d-bbc1-0afa8f10874e.jpg"
|
23 |
+
]
|
24 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
25 |
+
|
26 |
+
inputs = feature_extractor(images=image, return_tensors="pt")
|
27 |
+
outputs = model(**inputs)
|
28 |
+
logits = outputs.logits # shape (batch_size, num_labels, height/4, width/4)
|
29 |
+
```
|
30 |
+
|
31 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
config.json
CHANGED
@@ -7,8 +7,8 @@
|
|
7 |
"decoder_hidden_size": 768,
|
8 |
"depths": [
|
9 |
3,
|
10 |
-
|
11 |
-
|
12 |
3
|
13 |
],
|
14 |
"downsampling_rates": [
|
|
|
7 |
"decoder_hidden_size": 768,
|
8 |
"depths": [
|
9 |
3,
|
10 |
+
4,
|
11 |
+
18,
|
12 |
3
|
13 |
],
|
14 |
"downsampling_rates": [
|
preprocessor_config.json
CHANGED
@@ -14,5 +14,5 @@
|
|
14 |
],
|
15 |
"reduce_labels": false,
|
16 |
"resample": 2,
|
17 |
-
"size":
|
18 |
}
|
|
|
14 |
],
|
15 |
"reduce_labels": false,
|
16 |
"resample": 2,
|
17 |
+
"size": 512
|
18 |
}
|
pytorch_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4b3916b8781255eaa6b596be75eb4610001e2ff18083a4aa897539e1d1f41f3f
|
3 |
+
size 189204985
|
tf_model.h5
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c522e7c5c3416e9c2009fbd90cd6e36912b8d9d8b1cd0c591e1be4daadbfb343
|
3 |
+
size 189787044
|