Exemple #1
0
def get_semseg_axon_model():
    try:
        from elektronn3.models.base import InferenceModel
    except Exception as e:  # ImportError as e:
        log_main.error(
            "elektronn3 could not be imported ({}). Please see 'https://github."
            "com/ELEKTRONN/elektronn3' for more information.".format(e))
    path = global_params.config.mpath_axonsem
    m = InferenceModel(path)
    m._path = path
    return m
Exemple #2
0
def get_tripletnet_model_large_e3():
    """Those networks are typically trained with `naive_view_normalization_new` """
    try:
        from elektronn3.models.base import InferenceModel
    except Exception as e:  # ImportError as e:
        log_main.error(
            "elektronn3 could not be imported ({}). Please see 'https://github."
            "com/ELEKTRONN/elektronn3' for more information.".format(e))
    m_path = global_params.config.mpath_tnet_large
    m = InferenceModel(m_path)
    return m
Exemple #3
0
def get_celltype_model_large_e3():
    """Those networks are typically trained with `naive_view_normalization_new`
     Unlike the other e3 InferenceModel instances, here the view normalization
     is applied in the downstream inference method (`predict_sso_celltype`)
      because the celltype model also gets scalar values as input which should
      not be normalized."""
    try:
        from elektronn3.models.base import InferenceModel
    except Exception as e:  # ImportError as e:
        log_main.error(
            "elektronn3 could not be imported ({}). Please see 'https://github."
            "com/ELEKTRONN/elektronn3' for more information.".format(e))
    path = global_params.config.mpath_celltype_large_e3
    m = InferenceModel(path)
    return m
Exemple #4
0
def get_glia_model_e3():
    """Those networks are typically trained with `naive_view_normalization_new` """
    from elektronn3.models.base import InferenceModel
    path = global_params.config.mpath_glia_e3
    m = InferenceModel(path, normalize_func=naive_view_normalization_new)
    return m
Exemple #5
0
            'location.')
    # set working directory to obtain models
    global_params.wd = path_to_workingdir

    model_p = args.modelpath

    if model_p is None:
        m = get_semseg_axon_model()
    else:
        try:
            from elektronn3.models.base import InferenceModel
        except ImportError as e:
            msg = "elektronn3 could not be imported ({}). Please see 'https://github." \
                  "com/ELEKTRONN/elektronn3' for more information.".format(e)
            raise ImportError(msg)
        m = InferenceModel(model_p)
        m._path = model_p

    # get model for compartment detection

    view_props = global_params.view_properties_semsegax
    view_props["verbose"] = True

    # load SSO instance from k.zip file
    sso = init_sso_from_kzip(cell_kzip_fn, sso_id=1)
    # run prediction and store result in new kzip
    cell_kzip_fn_axon = cell_kzip_fn[:-6] + '_axon.k.zip'
    semseg_of_sso_nocache(sso,
                          dest_path=cell_kzip_fn_axon,
                          model=m,
                          **view_props)