Commit 7158b13e31181ab59363087ec6e365460c87cf39

Authored by Louis Baetens
1 parent d4931314
Exists in master

ENH metrics grapher has now a better legend

ALCD/contour_from_labeled.py
... ... @@ -225,6 +225,7 @@ def quick_contours(main_dir = ''):
225 225  
226 226 def generate_all_quicks():
227 227 ALCD_dir = '/mnt/data/home/baetensl/clouds_detection_git/Data_ALCD/'
  228 + ALCD_dir = '/mnt/data/home/baetensl/clouds_detection_git/Data_ALCD_Hollstein/'
228 229 all_dirs = glob.glob(op.join(ALCD_dir, '*_*_*'))
229 230 print(len(all_dirs))
230 231  
... ... @@ -234,8 +235,8 @@ def generate_all_quicks():
234 235  
235 236 def main():
236 237 main_dir = '/mnt/data/home/baetensl/clouds_detection_git/Data_ALCD/Arles_31TFJ_20171002'
237   - quick_contours(main_dir)
238   - #~ generate_all_quicks()
  238 + #~ quick_contours(main_dir)
  239 + generate_all_quicks()
239 240 return
240 241  
241 242  
... ...
PCC/metrics_grapher.py
... ... @@ -75,14 +75,15 @@ def plot_all_metrics(comparison_parameters, reference_algo = 'alcd_initial'):
75 75 rects_rec = plt.bar(index + 2*bar_width, recalls, bar_width,
76 76 alpha=opacity,
77 77 color=[0.8,0.9,0.45],
78   - label='Recall (~sous-detection)')
  78 + label='Recall')
79 79  
80 80 rects_pre = plt.bar(index + 3*bar_width, precisions, bar_width,
81 81 alpha=opacity,
82 82 color=[0.0,0.6,0.9],
83   - label='Precision (~sur-detection)')
  83 + label='Precision')
84 84  
85   - plt.xlabel('Processing chain')
  85 + #~ plt.xlabel('Processing chain')
  86 + plt.ylim(0,1.2)
86 87 plt.ylabel('Scores')
87 88  
88 89 location = comparison_parameters["automatically_generated"]["location"]
... ... @@ -91,8 +92,10 @@ def plot_all_metrics(comparison_parameters, reference_algo = 'alcd_initial'):
91 92 plt.title('Results of the processing chains for {}, {}'.format(location, date))
92 93 plt.xticks(index + bar_width*(nb_metrics/2), chain_names)
93 94 plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
  95 + plt.legend(loc=9, ncol=2)
94 96  
95 97 out_fig = op.join(stats_dir, 'binary_metrics_{}_{}.png'.format(location, date))
  98 + print(out_fig)
96 99 plt.savefig(out_fig, bbox_inches='tight')
97 100 plt.close()
98 101  
... ...
Tools/export_data_alcd_publi.py
... ... @@ -109,11 +109,13 @@ def copy_all_data(src_data_alcd, dst_data_alcd):
109 109 print('\n{}'.format(op.basename(src_dir)))
110 110 global_parameters_path = op.join(src_dir, 'In_data', 'used_global_parameters.json')
111 111 location, cloudy_date, clear_date = get_location_dates_from_global_parameters(global_parameters_path)
  112 + if location == '29RPQ_20160417' and cloudy_date == '20160417':
  113 + continue
112 114  
113 115 # create the output dir
114 116 cloudy_product_name = get_product_name(location, cloudy_date, display = False)
115 117 if not location[0].isdigit():
116   - main_out_dir = op.join(dst_data_alcd, '26scenes', cloudy_product_name)
  118 + main_out_dir = op.join(dst_data_alcd, '32scenes', cloudy_product_name)
117 119 else:
118 120 main_out_dir = op.join(dst_data_alcd, 'Hollstein', cloudy_product_name)
119 121  
... ... @@ -132,7 +134,8 @@ def copy_all_data(src_data_alcd, dst_data_alcd):
132 134  
133 135 # Copy the contours
134 136 in_files.append(op.join(src_dir, 'Out', 'contours_superposition.png'))
135   - out_files.append(op.join(main_out_dir, 'Classification', 'contours.png'))
  137 + #~ out_files.append(op.join(main_out_dir, 'Classification', 'contours.png'))
  138 + out_files.append(op.join(main_out_dir, 'Classification', 'contours_{}_{}.png'.format(location,cloudy_date)))
136 139  
137 140 # Convert the confidence_enhanced to Byte, and copy it
138 141 in_confidence = op.join(src_dir, 'Out', 'confidence_enhanced.tif')
... ... @@ -168,10 +171,15 @@ def copy_all_data(src_data_alcd, dst_data_alcd):
168 171  
169 172  
170 173 def main():
171   - src_data_alcd = '/mnt/data/home/baetensl/clouds_detection_git/Data_ALCD'
  174 + src_main_dir = '/mnt/data/home/baetensl/clouds_detection_git'
172 175 dst_data_alcd = '/mnt/data/home/baetensl/clouds_detection_git/Data_ALCD_publication'
173   -
174   - copy_all_data(src_data_alcd, dst_data_alcd)
  176 + #~ for src_sub_dir in ['Data_ALCD', 'Data_ALCD_Hollstein']:
  177 + #~ src_data_alcd = op.join(src_main_dir, src_sub_dir)
  178 + #~ copy_all_data(src_data_alcd, dst_data_alcd)
  179 +
  180 + src_dir = '/mnt/data/home/baetensl/clouds_detection_git/Data_ALCD_publication/32scenes/S2A_OPER_PRD_MSIL1C_PDMC_20160417T203056_R137_V20160417T111159_20160417T111159'
  181 + dst_dir = '/mnt/data/home/baetensl/clouds_detection_git/Data_ALCD_publication/Hollstein/S2A_OPER_PRD_MSIL1C_PDMC_20160417T203056_R137_V20160417T111159_20160417T111159'
  182 + shutil.copytree(src_dir, dst_dir)
175 183 return
176 184  
177 185 location = 'Arles'
... ...
paths_configuration.json
... ... @@ -2,7 +2,6 @@
2 2 "global_chains_paths": {
3 3 "L1C": "/mnt/data/SENTINEL2/L1C_PDGS",
4 4 "L1C_old": "/mnt/data/home/baetensl/Hollstein/L1C_products",
5   - "maja_old": "/mnt/data/SENTINEL2/L2A_MAJA_baetensl",
6 5 "maja": "/mnt/data/SENTINEL2/L2A_MAJA",
7 6 "sen2cor": "/mnt/data/SENTINEL2/L2A_SEN2COR",
8 7 "fmask": "/mnt/data/home/baetensl/Programs/Fmask4_output",
... ...