Skip to content

Instantly share code, notes, and snippets.

View palonso's full-sized avatar

Pablo Alonso palonso

View GitHub Profile
@palonso
palonso / freezer.py
Last active February 11, 2022 08:15
Serialize a TensorFlow graph as a Protobuf file. Remove the nodes not into the `model` namespace.
# tensorflow: loading model
sess = tf.Session()
sess.run(tf.global_variables_initializer())
saver = tf.train.Saver()
results_folder = model + '/'
saver.restore(sess, results_folder)
gd = sess.graph.as_graph_def()
@palonso
palonso / extract-openl3-embeddings.py
Last active August 31, 2021 09:14
Extract Openl3 embeddings in Essentia.
from pathlib import Path
import essentia.standard as es
import numpy as np
from essentia import Pool
class MelSpectrogramOpenL3:
def __init__(self, hop_time):
self.hop_time = hop_time
@palonso
palonso / ismir_lbd_deep-embeddings-with-essentia-models.ipynb
Last active September 29, 2020 10:04
Embedding extraction demo for the ISMIR 2020 LBD "Deep embeddings with Essentia models"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@palonso
palonso / nsgcq_encoded.py
Last active November 14, 2019 17:12
Forward and Backward NSGCQ transforms. Complex values are encoded in 4 channes: real part magnitude, imag part magnitude, real part sign and imag part sign. This representation seems suitable for feeding NNs while allowing perfect reconstruction.
import numpy as np
import matplotlib.pyplot as plt
import essentia.pytools.spectral as sp
from essentia.standard import MonoLoader, MonoWriter
from essentia import lin2db
PARAMS = {
'frameSize': 2 ** 14,
'sampleRate': 44100,
@palonso
palonso / real-time_auto-tagging_with_essentia_tensorflow_pyaudio_musicnn.ipynb
Last active October 28, 2019 16:09
Real-time auto-tagging example using Essentia with Tensorflow and PyAudio to process the soundcard input using the MusiCNN model.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.