ASTUMJ12 commited on
Commit
488465d
·
1 Parent(s): 4d8a5dd

segmentation

Browse files
Files changed (2) hide show
  1. app.py +153 -103
  2. 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
- [22, 122, 213],
21
- [240, 3, 156],
22
- [87, 176, 33],
23
- [154, 88, 111],
24
- [63, 54, 244],
25
- [201, 235, 59],
26
- [102, 66, 183],
27
- [94, 147, 5],
28
- [39, 198, 247],
29
- [17, 149, 92],
30
- [130, 78, 184],
31
- [246, 119, 107],
32
- [225, 23, 68],
33
- [52, 189, 140],
34
- [142, 10, 22],
35
- [114, 161, 251],
36
- [168, 55, 34],
37
- [75, 203, 89],
38
- [32, 45, 235],
39
- [74, 1, 129],
40
- [31, 166, 96],
41
- [223, 51, 202],
42
- [57, 72, 27],
43
- [143, 191, 176],
44
- [111, 33, 244],
45
- [20, 155, 62],
46
- [128, 99, 209],
47
- [254, 120, 14],
48
- [229, 67, 175],
49
- [53, 206, 40],
50
- [198, 77, 10],
51
- [8, 166, 142],
52
- [133, 45, 111],
53
- [222, 199, 239],
54
- [56, 18, 90],
55
- [164, 98, 206],
56
- [239, 135, 60],
57
- [106, 28, 139],
58
- [49, 172, 224],
59
- [179, 109, 34],
60
- [12, 191, 157],
61
- [121, 64, 88],
62
- [243, 214, 127],
63
- [82, 11, 165],
64
- [158, 37, 192],
65
- [31, 144, 55],
66
- [176, 220, 252],
67
- [68, 5, 123],
68
- [220, 157, 73],
69
- [41, 183, 210],
70
- [173, 85, 14],
71
- [16, 131, 99],
72
- [135, 50, 177],
73
- [227, 202, 244],
74
- [47, 175, 217],
75
- [181, 112, 28],
76
- [15, 190, 160],
77
- [124, 66, 91],
78
- [241, 217, 130],
79
- [80, 13, 168],
80
- [157, 40, 195],
81
- [30, 147, 52],
82
- [175, 223, 249],
83
- [67, 7, 126],
84
- [218, 160, 76],
85
- [235, 141, 45],
86
- [101, 33, 149],
87
- [46, 178, 220],
88
- [182, 114, 31],
89
- [14, 193, 163],
90
- [122, 69, 94],
91
- [240, 219, 133],
92
- [79, 16, 171],
93
- [156, 43, 198],
94
- [29, 150, 58],
95
- [225, 207, 243],
96
- [51, 27, 121],
97
- [159, 107, 229],
98
- [234, 143, 48],
99
- [100, 35, 152],
100
- [239, 221, 136],
101
- [78, 19, 174],
102
- [155, 46, 201],
103
- [28, 152, 61],
104
- [173, 227, 243],
105
- [20, 127, 108],
106
- [138, 59, 179],
107
- [224, 209, 245],
108
- [50, 29, 124],
109
- [161, 109, 232],
110
- [233, 145, 51],
111
- [99, 37, 155],
112
- [44, 174, 226],
113
- [184, 118, 20],
114
- [12, 195, 169],
115
- [125, 73, 100],
116
- [238, 223, 139],
117
- [77, 22, 177],
118
- [154, 49, 204],
119
- [27, 154, 64],
120
- [51, 86, 205]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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=(800, 600)),
188
  outputs=['plot'],
189
- examples=["indoor.jpg", "indoor1.jpg", "indoor2.jpg", "indoor3.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