Spaces:
Sleeping
Sleeping
ASTUMJ12
commited on
Commit
·
488465d
1
Parent(s):
4d8a5dd
segmentation
Browse files- app.py +153 -103
- labels.txt +51 -1
app.py
CHANGED
|
@@ -17,107 +17,157 @@ model = TFSegformerForSemanticSegmentation.from_pretrained(
|
|
| 17 |
def ade_palette():
|
| 18 |
"""ADE20K palette that maps each class to RGB values."""
|
| 19 |
return [
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
]
|
| 122 |
|
| 123 |
labels_list = []
|
|
@@ -184,9 +234,9 @@ def sepia(input_img):
|
|
| 184 |
return fig
|
| 185 |
|
| 186 |
demo = gr.Interface(fn=sepia,
|
| 187 |
-
inputs=gr.Image(shape=(
|
| 188 |
outputs=['plot'],
|
| 189 |
-
examples=["indoor.jpg", "
|
| 190 |
allow_flagging='never')
|
| 191 |
|
| 192 |
|
|
|
|
| 17 |
def ade_palette():
|
| 18 |
"""ADE20K palette that maps each class to RGB values."""
|
| 19 |
return [
|
| 20 |
+
[45, 67, 89],
|
| 21 |
+
[112, 34, 200],
|
| 22 |
+
[15, 205, 77],
|
| 23 |
+
[88, 150, 33],
|
| 24 |
+
[255, 72, 190],
|
| 25 |
+
[93, 93, 93],
|
| 26 |
+
[200, 15, 77],
|
| 27 |
+
[209, 178, 255],
|
| 28 |
+
[44, 123, 255],
|
| 29 |
+
[255, 224, 140],
|
| 30 |
+
[178, 235, 244],
|
| 31 |
+
[100, 200, 50],
|
| 32 |
+
[15, 15, 255],
|
| 33 |
+
[77, 200, 200],
|
| 34 |
+
[255, 0, 221],
|
| 35 |
+
[181, 178, 255],
|
| 36 |
+
[90, 150, 10],
|
| 37 |
+
[15, 100, 150],
|
| 38 |
+
[255, 0, 0],
|
| 39 |
+
[100, 255, 255],
|
| 40 |
+
[255, 0, 221],
|
| 41 |
+
[45, 80, 190],
|
| 42 |
+
[15, 50, 15],
|
| 43 |
+
[255, 224, 0],
|
| 44 |
+
[178, 0, 255],
|
| 45 |
+
[30, 200, 30],
|
| 46 |
+
[45, 90, 255],
|
| 47 |
+
[33, 140, 200],
|
| 48 |
+
[255, 0, 221],
|
| 49 |
+
[25, 200, 255],
|
| 50 |
+
[181, 178, 255],
|
| 51 |
+
[255, 0, 0],
|
| 52 |
+
[255, 255, 0],
|
| 53 |
+
[209, 178, 255],
|
| 54 |
+
[0, 255, 0],
|
| 55 |
+
[150, 150, 150],
|
| 56 |
+
[255, 224, 140],
|
| 57 |
+
[255, 72, 190],
|
| 58 |
+
[15, 205, 77],
|
| 59 |
+
[93, 93, 93],
|
| 60 |
+
[178, 235, 244],
|
| 61 |
+
[255, 0, 221],
|
| 62 |
+
[209, 178, 255],
|
| 63 |
+
[44, 123, 255],
|
| 64 |
+
[255, 224, 140],
|
| 65 |
+
[178, 235, 244],
|
| 66 |
+
[100, 200, 50],
|
| 67 |
+
[15, 15, 255],
|
| 68 |
+
[77, 200, 200],
|
| 69 |
+
[255, 0, 221],
|
| 70 |
+
[181, 178, 255],
|
| 71 |
+
[90, 150, 10],
|
| 72 |
+
[15, 100, 150],
|
| 73 |
+
[255, 0, 0],
|
| 74 |
+
[100, 255, 255],
|
| 75 |
+
[255, 0, 221],
|
| 76 |
+
[45, 80, 190],
|
| 77 |
+
[15, 50, 15],
|
| 78 |
+
[255, 224, 0],
|
| 79 |
+
[178, 0, 255],
|
| 80 |
+
[30, 200, 30],
|
| 81 |
+
[45, 90, 255],
|
| 82 |
+
[33, 140, 200],
|
| 83 |
+
[255, 0, 221],
|
| 84 |
+
[25, 200, 255],
|
| 85 |
+
[181, 178, 255],
|
| 86 |
+
[255, 0, 0],
|
| 87 |
+
[255, 255, 0],
|
| 88 |
+
[209, 178, 255],
|
| 89 |
+
[0, 255, 0],
|
| 90 |
+
[150, 150, 150],
|
| 91 |
+
[255, 224, 140],
|
| 92 |
+
[255, 72, 190],
|
| 93 |
+
[15, 205, 77],
|
| 94 |
+
[93, 93, 93],
|
| 95 |
+
[200, 15, 77],
|
| 96 |
+
[209, 178, 255],
|
| 97 |
+
[44, 123, 255],
|
| 98 |
+
[255, 224, 140],
|
| 99 |
+
[178, 235, 244],
|
| 100 |
+
[100, 200, 50],
|
| 101 |
+
[15, 15, 255],
|
| 102 |
+
[77, 200, 200],
|
| 103 |
+
[255, 0, 221],
|
| 104 |
+
[181, 178, 255],
|
| 105 |
+
[90, 150, 10],
|
| 106 |
+
[15, 100, 150],
|
| 107 |
+
[255, 0, 0],
|
| 108 |
+
[100, 255, 255],
|
| 109 |
+
[255, 0, 221],
|
| 110 |
+
[45, 80, 190],
|
| 111 |
+
[15, 50, 15],
|
| 112 |
+
[255, 224, 0],
|
| 113 |
+
[178, 0, 255],
|
| 114 |
+
[30, 200, 30],
|
| 115 |
+
[45, 90, 255],
|
| 116 |
+
[33, 140, 200],
|
| 117 |
+
[255, 0, 221],
|
| 118 |
+
[25, 200, 255],
|
| 119 |
+
[181, 178, 255],
|
| 120 |
+
[255, 0, 0],
|
| 121 |
+
[255, 255, 0],
|
| 122 |
+
[209, 178, 255],
|
| 123 |
+
[0, 255, 0],
|
| 124 |
+
[150, 150, 150],
|
| 125 |
+
[255, 224, 140],
|
| 126 |
+
[255, 72, 190],
|
| 127 |
+
[15, 205, 77],
|
| 128 |
+
[93, 93, 93],
|
| 129 |
+
[200, 15, 77],
|
| 130 |
+
[209, 178, 255],
|
| 131 |
+
[44, 123, 255],
|
| 132 |
+
[255, 224, 140],
|
| 133 |
+
[178, 235, 244],
|
| 134 |
+
[100, 200, 50],
|
| 135 |
+
[15, 15, 255],
|
| 136 |
+
[77, 200, 200],
|
| 137 |
+
[255, 0, 221],
|
| 138 |
+
[181, 178, 255],
|
| 139 |
+
[90, 150, 10],
|
| 140 |
+
[15, 100, 150],
|
| 141 |
+
[255, 0, 0],
|
| 142 |
+
[100, 255, 255],
|
| 143 |
+
[255, 0, 221],
|
| 144 |
+
[45, 80, 190],
|
| 145 |
+
[15, 50, 15],
|
| 146 |
+
[255, 224, 0],
|
| 147 |
+
[178, 0, 255],
|
| 148 |
+
[30, 200, 30],
|
| 149 |
+
[45, 90, 255],
|
| 150 |
+
[33, 140, 200],
|
| 151 |
+
[255, 0, 221],
|
| 152 |
+
[181, 178, 255],
|
| 153 |
+
[90, 150, 10],
|
| 154 |
+
[15, 100, 150],
|
| 155 |
+
[255, 0, 0],
|
| 156 |
+
[100, 255, 255],
|
| 157 |
+
[255, 0, 221],
|
| 158 |
+
[45, 80, 190],
|
| 159 |
+
[15, 50, 15],
|
| 160 |
+
[255, 224, 0],
|
| 161 |
+
[178, 0, 255],
|
| 162 |
+
[30, 200, 30],
|
| 163 |
+
[45, 90, 255],
|
| 164 |
+
[33, 140, 200],
|
| 165 |
+
[255, 0, 221],
|
| 166 |
+
[25, 200, 255],
|
| 167 |
+
[181, 178, 255],
|
| 168 |
+
[255, 0, 0],
|
| 169 |
+
[255, 255, 0],
|
| 170 |
+
|
| 171 |
]
|
| 172 |
|
| 173 |
labels_list = []
|
|
|
|
| 234 |
return fig
|
| 235 |
|
| 236 |
demo = gr.Interface(fn=sepia,
|
| 237 |
+
inputs=gr.Image(shape=(400, 600)),
|
| 238 |
outputs=['plot'],
|
| 239 |
+
examples=["indoor.jpg", "indoor2.jpg", "indoor3.jpg", "indoor1.jpg"],
|
| 240 |
allow_flagging='never')
|
| 241 |
|
| 242 |
|
labels.txt
CHANGED
|
@@ -1,21 +1,30 @@
|
|
| 1 |
wall
|
| 2 |
building
|
|
|
|
| 3 |
floor
|
|
|
|
| 4 |
ceiling
|
|
|
|
| 5 |
bed
|
| 6 |
windowpane
|
|
|
|
| 7 |
cabinet
|
| 8 |
sidewalk
|
| 9 |
person
|
|
|
|
| 10 |
door
|
| 11 |
table
|
|
|
|
| 12 |
plant
|
| 13 |
curtain
|
| 14 |
chair
|
|
|
|
| 15 |
water
|
| 16 |
painting
|
| 17 |
sofa
|
| 18 |
shelf
|
|
|
|
|
|
|
| 19 |
mirror
|
| 20 |
rug
|
| 21 |
field
|
|
@@ -23,78 +32,119 @@ armchair
|
|
| 23 |
seat
|
| 24 |
fence
|
| 25 |
desk
|
|
|
|
| 26 |
wardrobe
|
| 27 |
lamp
|
| 28 |
bathtub
|
|
|
|
| 29 |
cushion
|
| 30 |
base
|
| 31 |
box
|
| 32 |
column
|
|
|
|
| 33 |
chest of drawers
|
| 34 |
counter
|
| 35 |
sand
|
| 36 |
sink
|
|
|
|
| 37 |
fireplace
|
| 38 |
refrigerator
|
| 39 |
grandstand
|
| 40 |
path
|
| 41 |
stairs
|
|
|
|
| 42 |
case
|
| 43 |
pool table
|
| 44 |
pillow
|
| 45 |
screen door
|
| 46 |
stairway
|
|
|
|
| 47 |
bridge
|
| 48 |
bookcase
|
| 49 |
blind
|
| 50 |
coffee table
|
| 51 |
toilet
|
|
|
|
| 52 |
book
|
|
|
|
| 53 |
bench
|
|
|
|
| 54 |
stove
|
| 55 |
palm
|
| 56 |
kitchen island
|
| 57 |
computer
|
| 58 |
swivel chair
|
|
|
|
| 59 |
bar
|
|
|
|
|
|
|
|
|
|
| 60 |
towel
|
| 61 |
light
|
|
|
|
|
|
|
| 62 |
chandelier
|
|
|
|
|
|
|
| 63 |
booth
|
| 64 |
television receiver
|
|
|
|
|
|
|
| 65 |
apparel
|
|
|
|
|
|
|
| 66 |
bannister
|
|
|
|
|
|
|
| 67 |
bottle
|
| 68 |
buffet
|
| 69 |
poster
|
| 70 |
stage
|
| 71 |
van
|
|
|
|
|
|
|
| 72 |
conveyer belt
|
| 73 |
canopy
|
| 74 |
washer
|
| 75 |
plaything
|
|
|
|
| 76 |
stool
|
|
|
|
| 77 |
basket
|
|
|
|
|
|
|
| 78 |
bag
|
|
|
|
| 79 |
cradle
|
| 80 |
oven
|
| 81 |
ball
|
| 82 |
food
|
| 83 |
step
|
|
|
|
| 84 |
trade name
|
| 85 |
microwave
|
| 86 |
pot
|
|
|
|
|
|
|
|
|
|
| 87 |
dishwasher
|
| 88 |
screen
|
| 89 |
blanket
|
|
|
|
| 90 |
hood
|
|
|
|
| 91 |
vase
|
|
|
|
|
|
|
| 92 |
ashcan
|
| 93 |
fan
|
|
|
|
| 94 |
crt screen
|
| 95 |
plate
|
| 96 |
monitor
|
|
|
|
| 97 |
shower
|
| 98 |
radiator
|
| 99 |
glass
|
| 100 |
-
clock
|
|
|
|
|
|
| 1 |
wall
|
| 2 |
building
|
| 3 |
+
sky
|
| 4 |
floor
|
| 5 |
+
tree
|
| 6 |
ceiling
|
| 7 |
+
road
|
| 8 |
bed
|
| 9 |
windowpane
|
| 10 |
+
grass
|
| 11 |
cabinet
|
| 12 |
sidewalk
|
| 13 |
person
|
| 14 |
+
earth
|
| 15 |
door
|
| 16 |
table
|
| 17 |
+
mountain
|
| 18 |
plant
|
| 19 |
curtain
|
| 20 |
chair
|
| 21 |
+
car
|
| 22 |
water
|
| 23 |
painting
|
| 24 |
sofa
|
| 25 |
shelf
|
| 26 |
+
house
|
| 27 |
+
sea
|
| 28 |
mirror
|
| 29 |
rug
|
| 30 |
field
|
|
|
|
| 32 |
seat
|
| 33 |
fence
|
| 34 |
desk
|
| 35 |
+
rock
|
| 36 |
wardrobe
|
| 37 |
lamp
|
| 38 |
bathtub
|
| 39 |
+
railing
|
| 40 |
cushion
|
| 41 |
base
|
| 42 |
box
|
| 43 |
column
|
| 44 |
+
signboard
|
| 45 |
chest of drawers
|
| 46 |
counter
|
| 47 |
sand
|
| 48 |
sink
|
| 49 |
+
skyscraper
|
| 50 |
fireplace
|
| 51 |
refrigerator
|
| 52 |
grandstand
|
| 53 |
path
|
| 54 |
stairs
|
| 55 |
+
runway
|
| 56 |
case
|
| 57 |
pool table
|
| 58 |
pillow
|
| 59 |
screen door
|
| 60 |
stairway
|
| 61 |
+
river
|
| 62 |
bridge
|
| 63 |
bookcase
|
| 64 |
blind
|
| 65 |
coffee table
|
| 66 |
toilet
|
| 67 |
+
flower
|
| 68 |
book
|
| 69 |
+
hill
|
| 70 |
bench
|
| 71 |
+
countertop
|
| 72 |
stove
|
| 73 |
palm
|
| 74 |
kitchen island
|
| 75 |
computer
|
| 76 |
swivel chair
|
| 77 |
+
boat
|
| 78 |
bar
|
| 79 |
+
arcade machine
|
| 80 |
+
hovel
|
| 81 |
+
bus
|
| 82 |
towel
|
| 83 |
light
|
| 84 |
+
truck
|
| 85 |
+
tower
|
| 86 |
chandelier
|
| 87 |
+
awning
|
| 88 |
+
streetlight
|
| 89 |
booth
|
| 90 |
television receiver
|
| 91 |
+
airplane
|
| 92 |
+
dirt track
|
| 93 |
apparel
|
| 94 |
+
pole
|
| 95 |
+
land
|
| 96 |
bannister
|
| 97 |
+
escalator
|
| 98 |
+
ottoman
|
| 99 |
bottle
|
| 100 |
buffet
|
| 101 |
poster
|
| 102 |
stage
|
| 103 |
van
|
| 104 |
+
ship
|
| 105 |
+
fountain
|
| 106 |
conveyer belt
|
| 107 |
canopy
|
| 108 |
washer
|
| 109 |
plaything
|
| 110 |
+
swimming pool
|
| 111 |
stool
|
| 112 |
+
barrel
|
| 113 |
basket
|
| 114 |
+
waterfall
|
| 115 |
+
tent
|
| 116 |
bag
|
| 117 |
+
minibike
|
| 118 |
cradle
|
| 119 |
oven
|
| 120 |
ball
|
| 121 |
food
|
| 122 |
step
|
| 123 |
+
tank
|
| 124 |
trade name
|
| 125 |
microwave
|
| 126 |
pot
|
| 127 |
+
animal
|
| 128 |
+
bicycle
|
| 129 |
+
lake
|
| 130 |
dishwasher
|
| 131 |
screen
|
| 132 |
blanket
|
| 133 |
+
sculpture
|
| 134 |
hood
|
| 135 |
+
sconce
|
| 136 |
vase
|
| 137 |
+
traffic light
|
| 138 |
+
tray
|
| 139 |
ashcan
|
| 140 |
fan
|
| 141 |
+
pier
|
| 142 |
crt screen
|
| 143 |
plate
|
| 144 |
monitor
|
| 145 |
+
bulletin board
|
| 146 |
shower
|
| 147 |
radiator
|
| 148 |
glass
|
| 149 |
+
clock
|
| 150 |
+
flag
|