builder
build_callback function
dlf.core.builder.build_callback(callback, args)
Builds and initializes a callback object.
Valid names are all framework callbacks located at frameworks/callback
Args
- callback: str. Name of the registered callback
- args: dict[str, dict[str, Any]]. Arguments to initialize the callback
Raises
- ValueError: If callback not exists
- ValueError: If initialization of callback went wrong
Returns
An instances of dlf.core.callback.Callback
build_data_generator function
dlf.core.builder.build_data_generator(name, args)
Builds and initializes a data generator.
Valid names are all registered data generators which are located at dlf/data_generators
Args
- name: str. Name of the registered data generator
- args: dict[str, dict[str, Any]]. Keyword arguments for the data generator
Raises
- FileNotFoundError: If there is no data reader for the given name
- ValueError: If the initialization of the data reader went wrong
Returns
A tf.data.Dataset object
build_evaluator function
dlf.core.builder.build_evaluator(evaluator, args)
Builds and initializes an evaluator object.
Valid names are all framework evaluators located at frameworks/evaluator
Args
- evaluator: str. Name of the registered evaluator
- args: dict[str, dict[str, Any]]. Arguments to initialize the evaluator
Raises
- ValueError: If evaluator not exists
- ValueError: If initialization of evaluator went wrong
Returns
An instances of dlf.core.evaluator.evaluator
build_loss function
dlf.core.builder.build_loss(name, args)
Builds and initializes a loss function.
Valid names are all in Keras available Losses and all losses in module dlf/losses (if registered)
Args
- name: str. Name of the loss function
- args: dict[str, dict[str, Any]]. Arguments to initialize the loss function
Raises
- ValueError: If loss function not exists
Returns
A tf.keras.losses.Loss object
build_metric function
dlf.core.builder.build_metric(name, kwargs)
Builds and initializes a metric based on a given name for this metric and with given arguments.
Valid names are all in Keras available Metrics and all metrics in module dlf/metrics (if registered)
Args
name (str): Name of the registered metric kwargs (dict): Arguments for the metric to initialize
Raises
- ValueError: If the metric is not valid or not registered
Returns
A metric with tf.keras.metrics.Metric as base class
build_model_wrapper function
dlf.core.builder.build_model_wrapper(name, kwargs)
Builds and initializes a model based on the name parameter with kwargs arguments.
Valid names are all in Keras available Applications and all models in module dlf/models (if registered)
Args
- name: str. Name of the model to initialize (Keras model or a framework model)
- kwargs: dict. Required argument to initialize a model
Raises
- FileNotFoundError: If no model exists for a given name
- ValueError: If the registered model is not subclass of ModelWrapper or the preprocessing function is not callable
- ValueError: If something went wrong during the initialization with the kwargs
Returns
A ModelWrapper object containing a the specified model, training and validation step
build_optimizer function
dlf.core.builder.build_optimizer(optimizer, args)
Builds and initializes an optimizer.
Valid names are all in Keras available Optimizers
Args
- optimizer: str. Name of the optimizer to initialize
- args: dict[str, dict[str, Any]]. Intialization arguments for the selected optimizier
Raises
- ValueError: If optimizer name does not exists in tf.keras.optimizers
- ValueError: If an invalid decay learning object is used as learning_rate
Returns
An instance of tf.keras.optimizers.Optimiizer
build_preprocessing_exectutor function
dlf.core.builder.build_preprocessing_exectutor(pipeline)
Builds and initializes a PreprocessingExecutor which contains a list of preprocessing methods.
Valid names are all registered methods in dlf/preprocessing (if registered)
Args
- pipeline: dict[str, dict[str, Any]. dictionary containing the name of a method as key and keyword arguments as values
Raises
- ValueError: If the requested preprocessing method not exists
Returns
A dlf.core.preprocessing.PreprocessingExecutor objects