deepblink.models package¶
Submodules¶
Module contents¶
Models module with the training loop and logic to handle data which feeds into the loop.
-
class
deepblink.models.
Model
(augmentation_args: Dict[KT, VT], dataset_args: Dict[KT, VT], dataset_cls: deepblink.datasets._datasets.Dataset, network_args: Dict[KT, VT], network_fn: Callable, loss_fn: Callable, optimizer_fn: Callable, train_args: Dict[KT, VT], pre_model: keras.engine.training.Model = None, **kwargs)[source]¶ Bases:
object
Base class, to be subclassed by predictors for specific type of data, e.g. spots.
Parameters: - dataset_args – Dataset arguments containing - version, cell_size, flip, illuminate, rotate, gaussian_noise, and translate.
- dataset_cls – Specific dataset class.
- network_args – Network arguments containing - n_channels.
- network_fn – Network function returning a built model.
- loss_fn – Loss function.
- optimizer_fn – Optimizer function.
- train_args – Training arguments containing - batch_size, epochs, learning_rate.
- pre_model – Loaded, pre-trained model to bypass a new network creation.
- Kwargs:
- batch_format_fn: Formatting function added in the specific model, e.g. spots. batch_augment_fn: Same as batch_format_fn for augmentation.
-
evaluate
(x: numpy.ndarray, y: numpy.ndarray) → List[float][source]¶ Evaluate on images / masks and return l2 norm and f1 score.
-
fit
(dataset: deepblink.datasets._datasets.Dataset, augment_val: bool = True, callbacks: list = None) → None[source]¶ Training loop.
-
metrics
¶ Return metrics.