args = vars(parser.parse_args()) # enforce CPU processing if necessary if args['cpu']: print('using CPU, hiding all CUDA_VISIBLE_DEVICES') os.environ['CUDA_VISIBLE_DEVICES'] = '-1' del args['cpu'] # limit the number of threads to be used if running on CPU import tensorflow as tf tf.config.threading.set_intra_op_parallelism_threads(args['threads']) del args['threads'] # default parameters path_label_list = os.path.join( synthseg_home, 'data/labels_classes_priors/SynthSeg_segmentation_labels.npy') path_names_list = os.path.join( synthseg_home, 'data/labels_classes_priors/SynthSeg_segmentation_names.npy') path_model = os.path.join(synthseg_home, 'models/SynthSeg.h5') args['segmentation_label_list'] = path_label_list args['segmentation_names_list'] = path_names_list args['path_model'] = path_model args['sigma_smoothing'] = 0.5 args['keep_biggest_component'] = True args['aff_ref'] = 'FS' # call predict predict(**args)
default=2, help="conv par level") parser.add_argument("--unet_feat", type=int, dest="unet_feat_count", default=24, help="number of features of Unet's first layer") parser.add_argument("--feat_mult", type=int, dest="feat_multiplier", default=2, help="factor of new feature maps per level") parser.add_argument("--no_batch_norm", action='store_true', dest="no_batch_norm", help="deactivate batch norm") # Evaluation parameters parser.add_argument( "--gt", type=str, default=None, dest="gt_folder", help= "folder containing ground truth segmentations, evaluation is performed only if this is " "specified. Evaluation results will be preferably stored in out_seg folder, or else in " "out_posteriors folder") args = parser.parse_args() predict(**vars(args))