This commit is contained in:
parent
5d4b3cfe60
commit
eef15fc0b8
@ -97,7 +97,6 @@ def main() -> None:
|
|||||||
client.loop_forever() # This blocks
|
client.loop_forever() # This blocks
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
logging.info("SIGINT recieved! Stopping...")
|
logging.info("SIGINT recieved! Stopping...")
|
||||||
pass
|
|
||||||
|
|
||||||
client.disconnect()
|
client.disconnect()
|
||||||
loopingtimer.stop()
|
loopingtimer.stop()
|
||||||
|
@ -80,8 +80,9 @@ class SoundPreProcessor(AbcPreProcessor):
|
|||||||
|
|
||||||
logging.info("The loaded model contains the following classes: " + ", ".join(self._classes))
|
logging.info("The loaded model contains the following classes: " + ", ".join(self._classes))
|
||||||
if target_class_name not in self._classes:
|
if target_class_name not in self._classes:
|
||||||
raise Exception(
|
raise ValueError(
|
||||||
f"The specified target class {target_class_name} is not in the possible classes (Wrong model info?)")
|
f"The specified target class {target_class_name} is not in the possible classes (Wrong model info?)"
|
||||||
|
)
|
||||||
|
|
||||||
self._target_id = self._classes.index(target_class_name)
|
self._target_id = self._classes.index(target_class_name)
|
||||||
|
|
||||||
@ -97,10 +98,10 @@ class SoundPreProcessor(AbcPreProcessor):
|
|||||||
signal = audioBasicIO.stereo_to_mono(signal)
|
signal = audioBasicIO.stereo_to_mono(signal)
|
||||||
|
|
||||||
if sampling_rate == 0:
|
if sampling_rate == 0:
|
||||||
raise Exception("Could not read the file properly: Sampling rate zero")
|
raise AssertionError("Could not read the file properly: Sampling rate zero")
|
||||||
|
|
||||||
if signal.shape[0] / float(sampling_rate) <= self._mid_window:
|
if signal.shape[0] / float(sampling_rate) <= self._mid_window:
|
||||||
raise Exception("Could not read the file properly: Signal shape is not good")
|
raise AssertionError("Could not read the file properly: Signal shape is not good")
|
||||||
|
|
||||||
# feature extraction:
|
# feature extraction:
|
||||||
mid_features, s, _ = \
|
mid_features, s, _ = \
|
||||||
|
@ -15,7 +15,7 @@ class LoopingTimer:
|
|||||||
"""
|
"""
|
||||||
Looping timer. Executes a function and repeates it in the given interval.
|
Looping timer. Executes a function and repeates it in the given interval.
|
||||||
"""
|
"""
|
||||||
def __init__(self, interval, function, tick_args=[], tick_kwargs={}):
|
def __init__(self, interval, function, tick_args=None, tick_kwargs=None):
|
||||||
"""
|
"""
|
||||||
Initialize class
|
Initialize class
|
||||||
:param interval:
|
:param interval:
|
||||||
@ -26,8 +26,8 @@ class LoopingTimer:
|
|||||||
self._timer = None
|
self._timer = None
|
||||||
self.interval = interval
|
self.interval = interval
|
||||||
self.function = function
|
self.function = function
|
||||||
self._tick_args = tick_args
|
self._tick_args = tick_args or []
|
||||||
self._tick_kwargs = tick_kwargs
|
self._tick_kwargs = tick_kwargs or {}
|
||||||
self.is_running = False
|
self.is_running = False
|
||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user