From 604c315b5e80b6d372726a6e477dde6508619ce9 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 28 Oct 2020 19:46:20 +0100 Subject: [PATCH] More Keras back-compatibility fixes --- micmon/model/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/micmon/model/__init__.py b/micmon/model/__init__.py index f04f035..57777bc 100644 --- a/micmon/model/__init__.py +++ b/micmon/model/__init__.py @@ -2,8 +2,8 @@ import json import os import numpy as np -from typing import List, Optional, Union -from keras import Sequential, losses, optimizers, metrics +from typing import List, Optional +from keras import Sequential from keras.layers import Layer from keras.models import load_model, Model as _Model @@ -17,9 +17,10 @@ class Model: # noinspection PyShadowingNames def __init__(self, layers: Optional[List[Layer]] = None, labels: Optional[List[str]] = None, - model: Optional[_Model] = None, optimizer: Union[str, optimizers.Optimizer] = 'adam', - loss: str = 'sparse_categorical_crossentropy', - metrics: List[Union[str, metrics.Metric]] = ('accuracy',), + model: Optional[_Model] = None, + optimizer='adam', + loss='sparse_categorical_crossentropy', + metrics=('accuracy',), low_freq: int = AudioSegment.default_low_freq, high_freq: int = AudioSegment.default_high_freq): assert layers or model