def train(self, input_path, get_features=True, train_top=True, fine_tune=True, train_dir_name='train', valid_dir_name='validation', epochs_top=500, epochs_fine=50, batch_size_top=250, batch_size_fine=16, save_bottleneck=True, bottleneck_file='bottleneck_features', save_labels=True, labels_file='labels', fine_tune_file='fine_tune_checkpoint', top_model_file='top_model_weights', **kwargs):
    " Train\n\n        Train the BlendHunter network.\n\n        Parameters\n        ----------\n        input_path : str\n            Path to input data\n        get_features : bool, optional\n            Option to get bottleneck features, default is True\n        train_top : bool, optional\n            Option to train top model, default is True\n        fine_tune : bool, optional\n            Option to run fine tuning component of training, default is True\n        train_dir_name : str, optional\n            Training data directory name, default is 'train'\n        valid_dir_name : str, optional\n            Validation data directory name, default is 'validation'\n        epochs_top : int, optional\n            Number of training epochs for top model, default is 500\n        epochs_fine : int, optional\n            Number of training epochs for fine tuning, default is 50\n        batch_size_top : int, optional\n            Batch size for top model, default is 256\n        batch_size_fine : int, optional\n            Batch size for fine tuning, default is 16\n        save_bottleneck : bool, optional\n            Option to save bottleneck features, default is True\n        bottleneck_file : str, optional\n            File name for bottleneck features, default is\n            'bottleneck_features'\n        fine_tune_file : str, optional\n            Training checkpoint for the fine tuning step, default is\n            'fine_tune_checkpoint'\n\n        "
    start = time()
    self._epochs_top = epochs_top
    self._epochs_fine = epochs_fine
    self._batch_size_top = batch_size_top
    self._batch_size_fine = batch_size_fine
    self._save_bottleneck = save_bottleneck
    self._save_labels = save_labels
    self._bottleneck_file = self._format(self._weights_path, bottleneck_file)
    self._labels_file = self._format(self._weights_path, labels_file)
    self._fine_tune_file = self._format(self._weights_path, fine_tune_file)
    self._features = {'train': {}, 'valid': {}}
    self._features['train']['dir'] = self._format(input_path, train_dir_name)
    self._features['valid']['dir'] = self._format(input_path, valid_dir_name)
    self._kwargs = kwargs
    self._get_target_shape(self._format(self._features['train']['dir'], self._classes[0]))
    if get_features:
        self._get_features()
    if train_top:
        self._train_top_model()
    if fine_tune:
        self._fine_tune()
    end = time()
    print('Duration {:0.2f}s'.format((end - start)))
Train

Train the BlendHunter network.

Parameters
----------
input_path : str
    Path to input data
get_features : bool, optional
    Option to get bottleneck features, default is True
train_top : bool, optional
    Option to train top model, default is True
fine_tune : bool, optional
    Option to run fine tuning component of training, default is True
train_dir_name : str, optional
    Training data directory name, default is 'train'
valid_dir_name : str, optional
    Validation data directory name, default is 'validation'
epochs_top : int, optional
    Number of training epochs for top model, default is 500
epochs_fine : int, optional
    Number of training epochs for fine tuning, default is 50
batch_size_top : int, optional
    Batch size for top model, default is 256
batch_size_fine : int, optional
    Batch size for fine tuning, default is 16
save_bottleneck : bool, optional
    Option to save bottleneck features, default is True
bottleneck_file : str, optional
    File name for bottleneck features, default is
    'bottleneck_features'
fine_tune_file : str, optional
    Training checkpoint for the fine tuning step, default is
    'fine_tune_checkpoint'
def train(self, input_path, get_features=True, train_top=True, fine_tune=True, train_dir_name='train', valid_dir_name='validation', epochs_top=500, epochs_fine=50, batch_size_top=250, batch_size_fine=16, save_bottleneck=True, bottleneck_file='bottleneck_features', save_labels=True, labels_file='labels', fine_tune_file='fine_tune_checkpoint', top_model_file='top_model_weights', **kwargs):
    " Train\n\n        Train the BlendHunter network.\n\n        Parameters\n        ----------\n        input_path : str\n            Path to input data\n        get_features : bool, optional\n            Option to get bottleneck features, default is True\n        train_top : bool, optional\n            Option to train top model, default is True\n        fine_tune : bool, optional\n            Option to run fine tuning component of training, default is True\n        train_dir_name : str, optional\n            Training data directory name, default is 'train'\n        valid_dir_name : str, optional\n            Validation data directory name, default is 'validation'\n        epochs_top : int, optional\n            Number of training epochs for top model, default is 500\n        epochs_fine : int, optional\n            Number of training epochs for fine tuning, default is 50\n        batch_size_top : int, optional\n            Batch size for top model, default is 256\n        batch_size_fine : int, optional\n            Batch size for fine tuning, default is 16\n        save_bottleneck : bool, optional\n            Option to save bottleneck features, default is True\n        bottleneck_file : str, optional\n            File name for bottleneck features, default is\n            'bottleneck_features'\n        fine_tune_file : str, optional\n            Training checkpoint for the fine tuning step, default is\n            'fine_tune_checkpoint'\n\n        "
    start = time()
    self._epochs_top = epochs_top
    self._epochs_fine = epochs_fine
    self._batch_size_top = batch_size_top
    self._batch_size_fine = batch_size_fine
    self._save_bottleneck = save_bottleneck
    self._save_labels = save_labels
    self._bottleneck_file = self._format(self._weights_path, bottleneck_file)
    self._labels_file = self._format(self._weights_path, labels_file)
    self._fine_tune_file = self._format(self._weights_path, fine_tune_file)
    self._features = {'train': {}, 'valid': {}}
    self._features['train']['dir'] = self._format(input_path, train_dir_name)
    self._features['valid']['dir'] = self._format(input_path, valid_dir_name)
    self._kwargs = kwargs
    self._get_target_shape(self._format(self._features['train']['dir'], self._classes[0]))
    if get_features:
        self._get_features()
    if train_top:
        self._train_top_model()
    if fine_tune:
        self._fine_tune()
    end = time()
    print('Duration {:0.2f}s'.format((end - start)))