Spaces:
Sleeping
Sleeping
Commit
·
d8e6a95
1
Parent(s):
1742cb5
test
Browse files
app.py
CHANGED
@@ -7,13 +7,17 @@ from PIL import Image
|
|
7 |
import tensorflow as tf
|
8 |
from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
|
9 |
|
|
|
10 |
feature_extractor = SegformerFeatureExtractor.from_pretrained(
|
11 |
"jakka/segformer-b0-finetuned-warehouse-part-1-V2"
|
12 |
)
|
|
|
|
|
13 |
model = TFSegformerForSemanticSegmentation.from_pretrained(
|
14 |
-
"jakka/segformer-b0-finetuned-warehouse-part-1-V2"
|
15 |
)
|
16 |
|
|
|
17 |
def ade_palette():
|
18 |
"""ADE20K palette that maps each class to RGB values."""
|
19 |
return [
|
|
|
7 |
import tensorflow as tf
|
8 |
from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
|
9 |
|
10 |
+
# Load feature extractor
|
11 |
feature_extractor = SegformerFeatureExtractor.from_pretrained(
|
12 |
"jakka/segformer-b0-finetuned-warehouse-part-1-V2"
|
13 |
)
|
14 |
+
|
15 |
+
# Load model using PyTorch weights
|
16 |
model = TFSegformerForSemanticSegmentation.from_pretrained(
|
17 |
+
"jakka/segformer-b0-finetuned-warehouse-part-1-V2", from_pt=True
|
18 |
)
|
19 |
|
20 |
+
|
21 |
def ade_palette():
|
22 |
"""ADE20K palette that maps each class to RGB values."""
|
23 |
return [
|