sconce.trainers package¶
sconce.trainers.autoencoder_trainer module¶
-
class
sconce.trainers.autoencoder_trainer.
AutoencoderMixin
[source]¶ Bases:
abc.ABC
-
class
sconce.trainers.autoencoder_trainer.
AutoencoderTrainer
(*, model, training_data_generator, test_data_generator, optimizer, monitor=None, rate_controller=None)[source]¶ Bases:
sconce.trainer.Trainer
,sconce.trainers.autoencoder_trainer.AutoencoderMixin
sconce.trainers.single_class_image_classifier_trainer module¶
-
class
sconce.trainers.single_class_image_classifier_trainer.
ClassifierTrainer
(*args, **kwargs)[source]¶ Bases:
sconce.trainer.Trainer
,sconce.trainers.single_class_image_classifier_trainer.SingleClassImageClassifierMixin
Warning
This class has been deprecated for
SingleClassImageClassifierTrainer
and will be removed soon. It will continue to work for now, but please update your code accordingly.
-
class
sconce.trainers.single_class_image_classifier_trainer.
SingleClassImageClassifierMixin
[source]¶ Bases:
abc.ABC
-
plot_samples
(predicted_class, true_class=None, data_generator=None, sort_by='rising predicted class score', num_samples=7, num_cols=7, figure_width=15, image_height=3, cache_results=True)[source]¶ Plot samples of the dataset where the given <predicted_class> was predicted by the model.
Parameters: - predicted_class (int or string) – the class string or the index of the class that was predicted by the model.
- true_class (int or string) – the class string or the index of the class that the image actually belongs to.
- data_generator (
SingleClassImageDataGenerator
) – the data generator to use to find the samples. - sort_by (string) – one of the sort_by strings, see note below.
- num_samples (int) – the number of sample images to plot.
- num_cols (int) – the number of columns to plot, one image per column.
- figure_width (float) – the size, in matplotlib-inches, for the width of the whole figure.
- image_height (float) – the size, in matplotlib-inches, for the height of a single image.
- cache_results (bool) – keep the results in memory to make subsequent plots faster. Beware, that on large datasets (like imagenet) this can cause your system to run out of memory.
Note
- The sort_by strings supported are:
- “rising predicted class score”: samples are plotted in order of the lowest predicted class score to the highest predicted class score.
- “falling predicted class score”: samples are plotted in order of the higest predicted class score to the lowest predicted class score.
- “rising true class score”: samples are plotted in order of the lowest true class score to the highest true class score.
- “falling true class score”: samples are plotted in order of the higest true class score to the lowest true class score.
-
-
class
sconce.trainers.single_class_image_classifier_trainer.
SingleClassImageClassifierTrainer
(*, model, training_data_generator, test_data_generator, optimizer, monitor=None, rate_controller=None)[source]¶ Bases:
sconce.trainer.Trainer
,sconce.trainers.single_class_image_classifier_trainer.SingleClassImageClassifierMixin
A trainer with some methods that are handy when you’re training an image classifier model. Specifically a model that classifies images into a single class per image.
New in 0.10.0 (Used to be called ClassifierTrainer)