Spaces:
Sleeping
Sleeping
Guillermo Uribe Vicencio
commited on
Commit
·
287334b
1
Parent(s):
36ac0c5
app.py
CHANGED
@@ -57,7 +57,7 @@ cdl_color_map = [{'value': 1, 'label': 'Natural vegetation', 'rgb': (233,255,190
|
|
57 |
{'value': 12, 'label': 'Sorghum', 'rgb':(255,158,15), 'qtt': 0},
|
58 |
{'value': 13, 'label': 'Other', 'rgb':(0,175,77), 'qtt': 0}]
|
59 |
|
60 |
-
def apply_color_map(rgb, color_map=cdl_color_map
|
61 |
|
62 |
rgb_mapped = rgb.copy()
|
63 |
|
@@ -180,7 +180,7 @@ def process_rgb(input, mask, indexes):
|
|
180 |
|
181 |
return rgb
|
182 |
|
183 |
-
def inference_on_file(target_image, model, custom_test_pipeline
|
184 |
|
185 |
target_image = target_image.name
|
186 |
time_taken=-1
|
@@ -214,7 +214,7 @@ def inference_on_file(target_image, model, custom_test_pipeline, map_resume):
|
|
214 |
output = np.vstack([output[None], output[None], output[None]]).astype(np.uint8)
|
215 |
|
216 |
|
217 |
-
output=apply_color_map(output
|
218 |
|
219 |
return rgb1,rgb2,rgb3,output
|
220 |
|
@@ -245,7 +245,7 @@ model = init_segmentor(config, ckpt, device='cpu')
|
|
245 |
custom_test_pipeline=process_test_pipeline(model.cfg.data.test.pipeline, None)
|
246 |
|
247 |
|
248 |
-
func = partial(inference_on_file, model=model, custom_test_pipeline=custom_test_pipeline
|
249 |
print("")
|
250 |
bar_data = pd.DataFrame(map_resume)
|
251 |
|
|
|
57 |
{'value': 12, 'label': 'Sorghum', 'rgb':(255,158,15), 'qtt': 0},
|
58 |
{'value': 13, 'label': 'Other', 'rgb':(0,175,77), 'qtt': 0}]
|
59 |
|
60 |
+
def apply_color_map(rgb, color_map=cdl_color_map):
|
61 |
|
62 |
rgb_mapped = rgb.copy()
|
63 |
|
|
|
180 |
|
181 |
return rgb
|
182 |
|
183 |
+
def inference_on_file(target_image, model, custom_test_pipeline):
|
184 |
|
185 |
target_image = target_image.name
|
186 |
time_taken=-1
|
|
|
214 |
output = np.vstack([output[None], output[None], output[None]]).astype(np.uint8)
|
215 |
|
216 |
|
217 |
+
output=apply_color_map(output).transpose((1,2,0))
|
218 |
|
219 |
return rgb1,rgb2,rgb3,output
|
220 |
|
|
|
245 |
custom_test_pipeline=process_test_pipeline(model.cfg.data.test.pipeline, None)
|
246 |
|
247 |
|
248 |
+
func = partial(inference_on_file, model=model, custom_test_pipeline=custom_test_pipeline)
|
249 |
print("")
|
250 |
bar_data = pd.DataFrame(map_resume)
|
251 |
|