Added more spans
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Pünkösd Marcell 2021-08-04 16:33:03 +02:00
parent b094ab43fa
commit 9b328cf259
2 changed files with 16 additions and 8 deletions

View File

@ -64,7 +64,8 @@ class ClassifierCache:
self._downloaded_files.append(weights_file_path)
# magic happens here
self._current_classifier = Classifier(model_file_path, weights_file_path)
with opentracing.tracer.start_active_span('classifier.loadNewClassifier'):
self._current_classifier = Classifier(model_file_path, weights_file_path)
def get_default_classifier(self) -> Tuple[dict, Classifier]:

View File

@ -18,14 +18,21 @@ from keras_preprocessing.image import ImageDataGenerator
class Classifier(object):
def __init__(self, model_filename: str, weights_filename: str):
with open(model_filename, 'r') as f:
self.loaded_model = model_from_json(f.read())
with opentracing.tracer.start_active_span('classifier.loadModel'):
with open(model_filename, 'r') as f:
self.loaded_model = model_from_json(f.read())
self.loaded_model.load_weights(weights_filename)
self.datagen = ImageDataGenerator(rescale=1. / 255., validation_split=0.25)
self.loaded_model.compile(optimizers.RMSprop(lr=0.0005, decay=1e-6), loss="categorical_crossentropy",
metrics=["accuracy"])
self.loaded_model.summary()
with opentracing.tracer.start_active_span('classifier.loadWeights'):
self.loaded_model.load_weights(weights_filename)
with opentracing.tracer.start_active_span('classifier.loadDatagen'):
self.datagen = ImageDataGenerator(rescale=1. / 255., validation_split=0.25)
with opentracing.tracer.start_active_span('classifier.compile'):
self.loaded_model.compile(optimizers.RMSprop(lr=0.0005, decay=1e-6), loss="categorical_crossentropy",
metrics=["accuracy"])
self.loaded_model.summary() # prints to stdout??
@staticmethod
def create_spectrogram(wav_filename: str) -> Tuple[str, str]: