示例#1
0
def use_orcanet():
    temp_folder = "output/"
    os.mkdir(temp_folder)

    make_dummy_data(temp_folder)
    list_file = "example_list.toml"

    organizer = Organizer(temp_folder + "sum_model", list_file)
    organizer.cfg.train_logger_display = 10

    model = make_dummy_model()
    organizer.train_and_validate(model, epochs=3)

    organizer.predict()
示例#2
0
def predict(directory,
            list_file=None,
            config_file=None,
            epoch=None,
            fileno=None):
    from orcanet.core import Organizer

    orga = Organizer(directory, list_file, config_file, tf_log_level=1)
    return orga.predict(epoch=epoch, fileno=fileno)[0]
示例#3
0
def orca_pred(output_folder,
              list_file,
              config_file,
              model_file,
              epoch=None,
              fileno=None):
    """
    Run orga.predict with predefined ModelBuilder networks using a parser.

    Per default, the most recent saved model will be loaded.

    Parameters
    ----------
    output_folder : str
        Path to the folder where everything gets saved to, e.g. the summary
        log file, the plots, the trained models, etc.
    list_file : str
        Path to a list file which contains pathes to all the h5 files that
        should be used for training and validation.
    config_file : str
        Path to a .toml file which overwrites some of the default settings
        for training and validating a model.
    model_file : str
        Path to a file with parameters to build a model of a predefined
        architecture with OrcaNet.
    epoch : int, optional
        The epoch of the saved model to predict with.
    fileno : int, optional
        The filenumber of the saved model to predict with.

    """
    # Set up the Organizer with the input data
    orga = Organizer(output_folder, list_file, config_file, tf_log_level=1)

    # When predicting with a orga model, the right modifiers and custom
    # objects need to be given
    update_objects(orga, model_file)

    # Per default, a prediction will be done for the model with the
    # highest epoch and filenumber.
    orga.predict(epoch=epoch, fileno=fileno)