import argparse import logging import os import sys from functools import partial import numpy as np from imsegm.utilities import ImageDimensionError sys.path += [os.path.abspath('.'), os.path.abspath('..')] # Add path to root import imsegm.utilities.data_io as tl_data import imsegm.utilities.experiments as tl_expt NB_WORKERS = tl_expt.get_nb_workers(0.9) PATH_IMAGES = tl_data.update_path( os.path.join('data-images', 'drosophila_ovary_slice')) PATH_RESULTS = tl_data.update_path('results', absolute=True) PATHS = { 'annot': os.path.join(PATH_IMAGES, 'annot_eggs', '*.png'), 'image': os.path.join(PATH_IMAGES, 'image', '*.jpg'), 'output': os.path.join(PATH_RESULTS, 'cut_images'), } def arg_parse_params(dict_paths): """ SEE: https://docs.python.org/3/library/argparse.html :return ({str: str}, int): """
from imsegm.superpixels import segment_slic_img2d, segment_slic_img3d_gray from imsegm.utilities import ImageDimensionError from imsegm.utilities.experiments import get_nb_workers, WrapExecuteSequence # from sklearn import mixture #: select basic features extracted from superpixels FTS_SET_SIMPLE = FEATURES_SET_COLOR #: select default Classifier for supervised segmentation CLASSIF_NAME = DEFAULT_CLASSIF_NAME #: select default Modeling/clustering for unsupervised segmentation CLUSTER_METHOD = DEFAULT_CLUSTERING #: define how many images will be left out during cross-validation training CROSS_VAL_LEAVE_OUT = 2 #: default number of workers NB_WORKERS = get_nb_workers(0.6) def pipe_color2d_slic_features_model_graphcut( image, nb_classes, dict_features, sp_size=30, sp_regul=0.2, pca_coef=None, use_scaler=True, estim_model='GMM', gc_regul=1., gc_edge_type='model', debug_visual=None, ):