Esempio n. 1
0
    print('No display found. Using non-interactive Agg backend.')
    matplotlib.use('Agg')

import numpy as np
import pandas as pd
from sklearn import metrics
import matplotlib.pyplot as plt

sys.path += [os.path.abspath('.'), os.path.abspath('..')]  # Add path to root
import imsegm.utilities.experiments as tl_expt
import imsegm.utilities.data_io as tl_data
import imsegm.utilities.drawing as tl_visu
import imsegm.labeling as seg_lbs

EXPORT_VUSIALISATION = False
NB_WORKERS = tl_expt.nb_workers(0.9)

NAME_DIR_VISUAL_1 = 'ALL_visualisation-1'
NAME_DIR_VISUAL_2 = 'ALL_visualisation-2'
NAME_DIR_VISUAL_3 = 'ALL_visualisation-3'
SKIP_DIRS = [
    'input', 'simple', NAME_DIR_VISUAL_1, NAME_DIR_VISUAL_2, NAME_DIR_VISUAL_3
]
NAME_CSV_STAT = 'segmented-eggs_%s.csv'
PATH_IMAGES = tl_data.update_path(
    os.path.join('data-images', 'drosophila_ovary_slice'))
PATH_RESULTS = tl_data.update_path('results', absolute=True)
PATHS = {
    'images': os.path.join(PATH_IMAGES, 'image', '*.jpg'),
    'annots': os.path.join(PATH_IMAGES, 'annot_eggs', '*.png'),
    'segments': os.path.join(PATH_IMAGES, 'segm', '*.png'),
Esempio n. 2
0
from imsegm.labeling import histogram_regions_labels_norm
from imsegm.superpixels import segment_slic_img2d, segment_slic_img3d_gray
from imsegm.utilities.experiments import WrapExecuteSequence, nb_workers

# 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 = 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):
    """ complete pipe-line for segmentation using superpixels, extracting features
    and graphCut segmentation