From 96a3a81fb74e519285b9f36780e4164570d1d957 Mon Sep 17 00:00:00 2001 From: Chimezie Iwuanyanwu Date: Sat, 2 Dec 2023 17:17:57 -0600 Subject: [PATCH] Up-directory sample_collection_helper.py --- stepcovnet/data_collection/__init__.py | 0 stepcovnet/inputs.py | 5 ++--- .../sample_collection_helper.py | 0 training_data_collection.py | 12 +++++------- 4 files changed, 7 insertions(+), 10 deletions(-) delete mode 100644 stepcovnet/data_collection/__init__.py rename stepcovnet/{data_collection => }/sample_collection_helper.py (100%) diff --git a/stepcovnet/data_collection/__init__.py b/stepcovnet/data_collection/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/stepcovnet/inputs.py b/stepcovnet/inputs.py index 63cec17..94dd095 100644 --- a/stepcovnet/inputs.py +++ b/stepcovnet/inputs.py @@ -3,9 +3,8 @@ import numpy as np import tensorflow as tf -from stepcovnet import config, training +from stepcovnet import config, training, sample_collection_helper from stepcovnet.common.utils import get_samples_ngram_with_mask -from stepcovnet.data_collection.sample_collection_helper import get_audio_features class AbstractInput(ABC, object): @@ -16,7 +15,7 @@ def __init__(self, input_config, *args, **kwargs): class InferenceInput(AbstractInput): def __init__(self, inference_config: config.InferenceConfig): super(InferenceInput, self).__init__(input_config=inference_config) - self.audio_features = get_audio_features( + self.audio_features = sample_collection_helper.get_audio_features( wav_path=self.config.audio_path, file_name=self.config.file_name, config=self.config.dataset_config, diff --git a/stepcovnet/data_collection/sample_collection_helper.py b/stepcovnet/sample_collection_helper.py similarity index 100% rename from stepcovnet/data_collection/sample_collection_helper.py rename to stepcovnet/sample_collection_helper.py diff --git a/training_data_collection.py b/training_data_collection.py index 2582f00..84ddf12 100644 --- a/training_data_collection.py +++ b/training_data_collection.py @@ -9,17 +9,13 @@ import joblib import psutil -from stepcovnet import data +from stepcovnet import data, sample_collection_helper from stepcovnet.common.parameters import CONFIG, VGGISH_CONFIG from stepcovnet.common.utils import ( get_channel_scalers, get_filename, get_filenames_from_folder, ) -from stepcovnet.data_collection.sample_collection_helper import ( - feature_onset_phrase_label_sample_weights, - get_features_and_labels, -) def build_all_metadata(**kwargs): @@ -50,7 +46,9 @@ def collect_features(wav_path, timing_path, config, cores, file_name): binary_encoded_arrows, string_arrows, onehot_encoded_arrows, - ) = get_features_and_labels(wav_path, timing_path, file_name, config) + ) = sample_collection_helper.get_features_and_labels( + wav_path, timing_path, file_name, config + ) ( feature, label_dict, @@ -60,7 +58,7 @@ def collect_features(wav_path, timing_path, config, cores, file_name): binary_encoded_arrows_dict, string_arrows_dict, onehot_encoded_arrows_dict, - ) = feature_onset_phrase_label_sample_weights( + ) = sample_collection_helper.feature_onset_phrase_label_sample_weights( onsets, log_mel, arrows,