Fixed some type errors

This commit is contained in:
Pünkösd Marcell 2020-09-30 06:19:53 +02:00
parent 7bc08fdc8d
commit d19e0eb84a
1 changed files with 4 additions and 3 deletions

View File

@ -69,7 +69,6 @@ class SoundPreProcessor(AbcPreProcessor):
self._mid_window, self._mid_step, self._short_window, \
self._short_step, self._compute_beat = load_model(self._temp_model_name)
logging.info("The loaded model contains the following classes: " + ", ".join(self._classes))
if config.SVM_TARGET_CLASS_NAME not in self._classes:
raise Exception(f"The specified target class {config.SVM_TARGET_CLASS_NAME} is not in the possible classes")
@ -111,9 +110,11 @@ class SoundPreProcessor(AbcPreProcessor):
target_id = self._classes.index(config.SVM_TARGET_CLASS_NAME) # Might raise ValueError
feature_vector = (mid_features - self._mean) / self._std
class_id, probability = classifier_wrapper(self._classifier, self._model_details['type'], feature_vector)
class_id, probability = classifier_wrapper(self._classifier, self._model_details['type'].lower(),
feature_vector)
class_id = int(class_id) # faszom
logging.debug(f"Sample {file_path} identified as {self._classes[class_id]} with the probablility of {probability}")
logging.debug(f"Sample {file_path} identified as {self._classes[class_id]} with the probablility of {probability[class_id]}")
return bool(class_id == target_id)