@@ -108,6 +108,13 @@ def main():
108108 default_model = "cyto3"
109109 backbone = "default"
110110
111+ if args .norm_percentile is not None :
112+ value1 , value2 = args .norm_percentile
113+ normalize = {'percentile' : (float (value1 ), float (value2 ))}
114+ else :
115+ normalize = (not args .no_norm )
116+
117+
111118 model_type = None
112119 if pretrained_model and not os .path .exists (pretrained_model ):
113120 model_type = pretrained_model if pretrained_model is not None else "cyto3"
@@ -209,7 +216,7 @@ def main():
209216 cellprob_threshold = args .cellprob_threshold ,
210217 stitch_threshold = args .stitch_threshold , min_size = args .min_size ,
211218 invert = args .invert , batch_size = args .batch_size ,
212- interp = (not args .no_interp ), normalize = ( not args . no_norm ) ,
219+ interp = (not args .no_interp ), normalize = normalize ,
213220 channel_axis = args .channel_axis , z_axis = args .z_axis ,
214221 anisotropy = args .anisotropy , niter = args .niter ,
215222 dP_smooth = args .dP_smooth )
@@ -303,7 +310,7 @@ def main():
303310 test_data = test_images , test_labels = test_labels ,
304311 test_files = image_names_test , train_probs = train_probs ,
305312 test_probs = test_probs , compute_flows = compute_flows ,
306- load_files = load_files , normalize = ( not args . no_norm ) ,
313+ load_files = load_files , normalize = normalize ,
307314 channels = channels , channel_axis = args .channel_axis , rgb = (nchan == 3 ),
308315 learning_rate = args .learning_rate , weight_decay = args .weight_decay ,
309316 SGD = args .SGD , n_epochs = args .n_epochs , batch_size = args .batch_size ,
@@ -327,7 +334,7 @@ def main():
327334 load_files = load_files , channels = channels ,
328335 min_train_masks = args .min_train_masks ,
329336 channel_axis = args .channel_axis , rgb = (nchan == 3 ),
330- nimg_per_epoch = args .nimg_per_epoch , normalize = ( not args . no_norm ) ,
337+ nimg_per_epoch = args .nimg_per_epoch , normalize = normalize ,
331338 nimg_test_per_epoch = args .nimg_test_per_epoch ,
332339 batch_size = args .batch_size )
333340 if test_images is not None :
0 commit comments