Fixed up logging
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
6de17cf962
commit
7bc08fdc8d
@ -69,13 +69,18 @@ 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")
|
||||
|
||||
def preprocesssignal(self, file_path: str) -> bool:
|
||||
"""
|
||||
Classify a sound sample.
|
||||
:param file_path: Access path of the sound sample up for processing.
|
||||
:return:
|
||||
"""
|
||||
logging.info("Running extraction...")
|
||||
logging.debug("Running extraction...")
|
||||
|
||||
sampling_rate, signal = audioBasicIO.read_audio_file(file_path)
|
||||
signal = audioBasicIO.stereo_to_mono(signal)
|
||||
@ -101,13 +106,15 @@ class SoundPreProcessor(AbcPreProcessor):
|
||||
mid_features = numpy.append(mid_features, beat)
|
||||
mid_features = numpy.append(mid_features, beat_conf)
|
||||
|
||||
logging.info("Running classification...")
|
||||
logging.debug("Running classification...")
|
||||
|
||||
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)
|
||||
|
||||
logging.debug(f"Sample {file_path} identified as {self._classes[class_id]} with the probablility of {probability}")
|
||||
|
||||
return bool(class_id == target_id)
|
||||
|
||||
def __del__(self):
|
||||
|
Loading…
Reference in New Issue
Block a user