diff --git a/README.md b/README.md index 9cdfab0..0a7c792 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,10 @@ Clone it to find a collection of: - Utility Function for Model I/O - DL Modules - A Plotter Object - - Audio Related Tools and Funtion + - Audio related Tools and Funtion - Librosa - Scipy Signal + - PointCloud related Tools and Functions ###Notes: - Use directory links to link from your main project folder to the ml_lib folder. Pycharm will automatically use @@ -19,11 +20,10 @@ Clone it to find a collection of: \ \ For Windows Users: - ``` + ``` bash mklink /d "ml_lib" "..\ml_lib"" ``` For Unix User: + ``` bash + ln -s ../ml_lib ml_lib ``` - TBA - ``` - - Cheers \ No newline at end of file diff --git a/audio_toolset/audio_augmentation.py b/audio_toolset/audio_augmentation.py index 244dd4d..bf35b13 100644 --- a/audio_toolset/audio_augmentation.py +++ b/audio_toolset/audio_augmentation.py @@ -9,18 +9,19 @@ import numpy as np class Speed(object): - def __init__(self, max_ratio=0.3, speed_factor=1): - self.speed_factor = speed_factor - self.max_ratio = max_ratio + def __init__(self, max_amount=0.3, speed_min=1, speed_max=1): + self.speed_max = speed_max + self.speed_min = speed_min + self.max_amount = max_amount def __call__(self, x): - if not all([self.speed_factor, self.max_ratio]): - return x - start = int(np.random.randint(0, x.shape[-1],1)) - end = int((np.random.uniform(0, self.max_ratio, 1) * x.shape[-1]) + start) + assert all([self.speed_min, self.speed_max, self.max_amount]) + start = int(np.random.randint(low=0, high=x.shape[-1], size=1)) + width = np.random.uniform(low=0, high=self.max_amount, size=1) * x.shape[-1] + end = int(width + start) end = min(end, x.shape[-1]) try: - speed_factor = float(np.random.uniform(min(self.speed_factor, 1), max(self.speed_factor, 1), 1)) + speed_factor = float(np.random.uniform(low=self.speed_min, high=self.speed_max, size=1)) aug_data = librosa.effects.time_stretch(x[start:end], speed_factor) return np.concatenate((x[:start], aug_data, x[end:]), axis=0)[:x.shape[-1]] except ValueError: diff --git a/requirements.txt b/requirements.txt index 03ecf69..cc358ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,62 +1,8 @@ -absl-py==0.9.0 -attrs==19.3.0 -bravado==10.6.0 -bravado-core==5.17.0 -cachetools==4.1.0 -certifi==2020.4.5.1 -chardet==3.0.4 -click==7.1.2 -future==0.18.2 -gitdb==4.0.5 -GitPython==3.1.2 -google-auth==1.15.0 -google-auth-oauthlib==0.4.1 -grpcio==1.29.0 -idna==2.9 -imageio==2.8.0 -jsonpointer==2.0 -jsonref==0.2 -jsonschema==3.2.0 -Markdown==3.2.2 -monotonic==1.5 -msgpack==1.0.0 -msgpack-python==0.5.6 natsort==7.0.1 -neptune-client==0.4.113 -numpy==1.18.4 -oauthlib==3.1.0 -packaging==20.4 -pandas==1.0.3 -Pillow==7.1.2 -protobuf==3.12.0 -py3nvml==0.2.6 -pyasn1==0.4.8 -pyasn1-modules==0.2.8 -PyJWT==1.7.1 -pyparsing==2.4.7 -pyrsistent==0.16.0 -python-dateutil==2.8.1 +neptune-client==0.4.109 pytorch-lightning==0.7.6 -pytz==2020.1 -PyYAML==5.3.1 -requests==2.23.0 -requests-oauthlib==1.3.0 -rfc3987==1.3.8 -rsa==4.0 -simplejson==3.17.0 -six==1.14.0 -smmap==3.0.4 -strict-rfc3339==0.7 -swagger-spec-validator==2.5.0 -tensorboard==2.2.1 -tensorboard-plugin-wit==1.6.0.post3 test-tube==0.7.5 -torch==1.5.0+cu101 -torchvision==0.6.0+cu101 -tqdm==4.46.0 -typing-extensions==3.7.4.2 -urllib3==1.25.9 -webcolors==1.11.1 -websocket-client==0.57.0 -Werkzeug==1.0.1 -xmltodict==0.12.0 +torch==1.4.0 +torchcontrib==0.0.2 +torchvision==0.5.0 +tqdm==4.45.0