def main(): audio_path_label_pairs = load_audio_path_label_pairs() print('loaded: ', len(audio_path_label_pairs)) classifier = Cifar10AudioClassifier(model_ctx=mxnet.gpu(0), data_ctx=mxnet.gpu(0)) batch_size = 8 epochs = 100 history = classifier.fit(audio_path_label_pairs, model_dir_path='./models', batch_size=batch_size, epochs=epochs, checkpoint_interval=2)
def main(): audio_path_label_pairs = load_audio_path_label_pairs() shuffle(audio_path_label_pairs) print('loaded: ', len(audio_path_label_pairs)) classifier = Cifar10AudioClassifier() classifier.load_model(model_dir_path='./models') for i in range(0, 20): audio_path, actual_label_id = audio_path_label_pairs[i] predicted_label_id = classifier.predict_class(audio_path) print(audio_path) predicted_label = gtzan_labels[predicted_label_id] actual_label = gtzan_labels[actual_label_id] print('predicted: ', predicted_label, 'actual: ', actual_label)
def main(): sys.path.append(patch_path('..')) audio_path_label_pairs = load_audio_path_label_pairs() print('loaded: ', len(audio_path_label_pairs)) from mxnet_audio.library.cifar10 import Cifar10AudioClassifier classifier = Cifar10AudioClassifier(model_ctx=mxnet.gpu(0), data_ctx=mxnet.gpu(0)) batch_size = 8 epochs = 100 history = classifier.fit(audio_path_label_pairs, model_dir_path=patch_path('models'), batch_size=batch_size, epochs=epochs, checkpoint_interval=2)
def main(): sys.path.append(patch_path('..')) audio_path_label_pairs = load_audio_path_label_pairs() shuffle(audio_path_label_pairs) print('loaded: ', len(audio_path_label_pairs)) from mxnet_audio.library.cifar10 import Cifar10AudioClassifier classifier = Cifar10AudioClassifier() classifier.load_model(model_dir_path=patch_path('models')) for i in range(0, 20): audio_path, actual_label_id = audio_path_label_pairs[i] audio2vec = classifier.encode_audio(audio_path) print(audio_path) print('audio-to-vec: ', audio2vec)
def main(): sys.path.append(patch_path("..")) audio_path_label_pairs = load_audio_path_label_pairs() shuffle(audio_path_label_pairs) print("loaded: ", len(audio_path_label_pairs)) from mxnet_audio.library.cifar10 import Cifar10AudioClassifier from mxnet_audio.library.utility.gtzan_loader import gtzan_labels classifier = Cifar10AudioClassifier() classifier.load_model(model_dir_path=patch_path("models")) for i in range(0, 20): audio_path, actual_label_id = audio_path_label_pairs[i] predicted_label_id = classifier.predict_class(audio_path) print(audio_path) predicted_label = gtzan_labels[predicted_label_id] actual_label = gtzan_labels[actual_label_id] print("predicted: ", predicted_label, "actual: ", actual_label)