Skip to content

Instantly share code, notes, and snippets.

View AhmadMoussa's full-sized avatar
🔮
Hello, is this Turing?

Ahmad Moussa AhmadMoussa

🔮
Hello, is this Turing?
View GitHub Profile
@AhmadMoussa
AhmadMoussa / WaveformZoomer.py
Last active December 9, 2019 07:33
Interactive Matplotlib tool that allows you to plot a waveform as well as zoom in on certain spots
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
import librosa
fig, ax = plt.subplots()
plt.subplots_adjust(left=0.1, bottom=0.35)
samples = 1
audio, sr = librosa.core.load("Snare.wav") # load your audio here
@AhmadMoussa
AhmadMoussa / PyTorchUNet.py
Last active March 20, 2020 19:25
Minimal Code to create a scalable UNet in PyTorch.
import torch
from torch import nn
def convBlock(inc, outc, ksz, conv_or_deconv):
return nn.Sequential(
nn.Conv2d(in_channels=inc, out_channels=outc, kernel_size=ksz,
stride=2) if conv_or_deconv else nn.ConvTranspose2d(in_channels=inc, out_channels=outc,
kernel_size=ksz, stride=2),
nn.LeakyReLU(),
nn.BatchNorm2d(num_features=outc)