From 6b978525433eb69620e41773b84e9083d62ed6d3 Mon Sep 17 00:00:00 2001 From: AfaqSaeed <45476864+AfaqSaeed@users.noreply.github.com> Date: Tue, 9 Nov 2021 18:59:58 +0500 Subject: [PATCH 1/3] Update utils.py --- utils/utils.py | 62 ++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/utils/utils.py b/utils/utils.py index b1844c1..7527ad3 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -20,37 +20,35 @@ def add_weight_decay(net, l2_value, skip_list=()): return [{'params': no_decay, 'weight_decay': 0.0}, {'params': decay, 'weight_decay': l2_value}] # function for colorizing a label image: -def label_img_to_color(img): - label_to_color = { - 0: [128, 64,128], - 1: [244, 35,232], - 2: [ 70, 70, 70], - 3: [102,102,156], - 4: [190,153,153], - 5: [153,153,153], - 6: [250,170, 30], - 7: [220,220, 0], - 8: [107,142, 35], - 9: [152,251,152], - 10: [ 70,130,180], - 11: [220, 20, 60], - 12: [255, 0, 0], - 13: [ 0, 0,142], - 14: [ 0, 0, 70], - 15: [ 0, 60,100], - 16: [ 0, 80,100], - 17: [ 0, 0,230], - 18: [119, 11, 32], - 19: [81, 0, 81] - } - - img_height, img_width = img.shape - - img_color = np.zeros((img_height, img_width, 3)) - for row in range(img_height): - for col in range(img_width): - label = img[row, col] - - img_color[row, col] = np.array(label_to_color[label]) +def label_img_to_color_20(img): + img=img.astype(np.uint8) + lut=np.ones((256,1,3),dtype=np.uint8) + + ine = np.array([[ + [128, 64,128],#road 0 + [244, 35,232],#sidewalk 1 + [ 70, 70, 70],#building 2 + [190,153,153],#wall 3 + [153,153,153],#fence 4 + [250,170, 30],#pole 5 + [220,220, 0],#traffic light 6 + [0,0, 255],#traffic sign 7 + [152,251,152],#vegetation 8 + [ 70,130,180],#terrain 9 + [220, 20, 60],#sky 10 + [255, 0, 0],#person 11 + [ 0, 0,142],#rider 12 + [ 0, 0, 70],#car 13 + [ 0, 60,100],#truck 14 + [ 0, 80,100],#bus 15 + [ 0, 0,230],#train 16 + [119, 11, 32],#motorcycle 17 + [81, 0, 81],#bicycle 18 + [0,0,0]#background 19 + ]]) + + + lut[0:20,:,:]=ine.reshape(20,1,3) + img_color=cv2.applyColorMap(img,lut) return img_color From c0512f144747e1dff274a96945b9a8cfe9fcdd58 Mon Sep 17 00:00:00 2001 From: AfaqSaeed <45476864+AfaqSaeed@users.noreply.github.com> Date: Tue, 9 Nov 2021 19:10:52 +0500 Subject: [PATCH 2/3] Update eval_on_val.py --- evaluation/eval_on_val.py | 1 - 1 file changed, 1 deletion(-) diff --git a/evaluation/eval_on_val.py b/evaluation/eval_on_val.py index 42736df..6278223 100644 --- a/evaluation/eval_on_val.py +++ b/evaluation/eval_on_val.py @@ -1,7 +1,6 @@ # camera-ready import sys - sys.path.append("/root/deeplabv3") from datasets import DatasetVal # (this needs to be imported before torch, because cv2 needs to be imported before torch for some reason) From 3916e0b6aa2df16412b5a98a76c071f1deb96e5f Mon Sep 17 00:00:00 2001 From: AfaqSaeed <45476864+AfaqSaeed@users.noreply.github.com> Date: Tue, 9 Nov 2021 19:14:15 +0500 Subject: [PATCH 3/3] Update utils.py --- utils/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/utils.py b/utils/utils.py index 7527ad3..6d52237 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -20,7 +20,7 @@ def add_weight_decay(net, l2_value, skip_list=()): return [{'params': no_decay, 'weight_decay': 0.0}, {'params': decay, 'weight_decay': l2_value}] # function for colorizing a label image: -def label_img_to_color_20(img): +def label_img_to_color(img): img=img.astype(np.uint8) lut=np.ones((256,1,3),dtype=np.uint8)