Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Jaekoo Kang jaekookang

🎯
Focusing
View GitHub Profile
@jaekookang
jaekookang / python_hparam_dotted_dict.py
Last active May 9, 2020
Python Import Hyper-parameters as a Dotted Dictionary
View python_hparam_dotted_dict.py
'''
Make dotted dictionary from hyper-parameter file (.yaml)
This `HParams` class lets you import your hyper-parameter file in .yaml
into Python as a dotted dicionary. There are different approaches to implement
dotted dictionary, but there are not many methods that I was not satisfied with.
For example, `DotMap` module doesn't seem to be stable and becomes errorful silently.
This was the main motivation for developing my own version of dotted dictionary.
Purpose:
@jaekookang
jaekookang / monitor.py
Created Apr 20, 2020
TensorFlow2.x Keras Custom Train Logger Callback
View monitor.py
'''
This code snippet was developed based on
- https://github.com/keras-team/keras/issues/2850#issuecomment-222494059
How to use:
```
logger = NBatchLogger(n_display, n_epoch, log_dir)
model.fit(data_generator,
epochs=n_epoch,
callbacks=[logger],
@jaekookang
jaekookang / download_cmu_arctic.sh
Created Apr 17, 2020 — forked from r9y9/download_cmu_arctic.sh
CMU ARCTIC download script
View download_cmu_arctic.sh
#!/bin/bash
# This is a yet another download script for the cmu arctic speech corpus.
# The corpus will be downloaded in $HOME/data/cmu_arctic/
location=$HOME/data/cmu_arctic/
if [ ! -e $location ]
then
echo "Create " $location
@jaekookang
jaekookang / audioprobe_mex.cpp
Created Dec 5, 2019
Compile MEX function (Matlab) with RtAudio on macOS
View audioprobe_mex.cpp
/*
Compiling MEX function including RtAudio for audio mauipulation (Toy example)
Tested on:
- macOS Catalina 10.15
- Matlab R2019b (XCode clang++)
- RtAudio v5.1.0
To use this .cpp file to compile mex function, you need to download RtAudio first
(See https://www.music.mcgill.ca/~gary/rtaudio/).
@jaekookang
jaekookang / ffmpeg.md
Created May 16, 2019 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files
View ffmpeg.md

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@jaekookang
jaekookang / git-clearHistory
Created Feb 24, 2019 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
View git-clearHistory
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@jaekookang
jaekookang / train.py
Created Jul 3, 2018
Task: Fill in the blank in a sentence / training script snippet (in progress)
View train.py
'''
Train
python 3.6.4
tensorflow 0.12.1
2018-06-30
'''
import ipdb as pdb
import os
import utils
@jaekookang
jaekookang / train.py
Created Jul 3, 2018
Task: Fill in the blank in a sentence.
View train.py
'''
Train
python 3.6.4
tensorflow 0.12.1
2018-06-30
'''
import ipdb as pdb
import os
import utils
@jaekookang
jaekookang / thread.py
Created Apr 7, 2018 — forked from ruedesign/thread.py
Python thread sample with handling Ctrl-C
View thread.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, time, threading, abc
from optparse import OptionParser
def parse_options():
parser = OptionParser()
parser.add_option("-t", action="store", type="int", dest="threadNum", default=1,
help="thread count [1]")
@jaekookang
jaekookang / min-char-rnn.py
Created Dec 12, 2016 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
View min-char-rnn.py
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
You can’t perform that action at this time.