This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
conda install -c conda-forge jupyter_contrib_nbextensions -y | |
# pip install jupyter jupyter_contrib_nbextensions | |
# jupyter contrib nbextension install --user | |
jupyter nbextension enable toc2/main | |
jupyter nbextension enable execute_time/ExecuteTime | |
jupyter nbextension enable python-markdown/main | |
jupyter nbextension enable scratchpad/main | |
jupyter nbextension enable move_selected_cells/main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.2.0-Linux-x86_64.sh | |
sh Anaconda3-5.2.0-Linux-x86_64.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Warning: This script is untested. (copy from command history) | |
# Install | |
curl -fsSL get.docker.com -o get-docker.sh | exit -1 | |
sudo sh get-docker.sh | exit -1 | |
# Add user to docker group (sudoless) | |
sudo gpasswd -a ${USER} docker | exit -1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main multiverse restricted universe | |
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main multiverse restricted universe | |
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main multiverse restricted universe | |
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main multiverse restricted universe | |
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main multiverse restricted universe | |
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main multiverse restricted universe | |
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main multiverse restricted universe | |
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main multiverse restricted universe | |
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main multiverse restricted universe | |
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main multiverse restricted universe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn import metrics | |
from scipy.optimize import brentq | |
from scipy.interpolate import interp1d | |
def cal_eer(score_true, score_false): | |
""" 计算EER | |
Args: | |
scores_true: 正样例的分数列表 | |
scores_false: 负样例的分数列表 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
import os | |
from multiprocessing.dummy import Pool | |
def can_ping(ip): | |
ret = os.system('ping -n 1 -w 1 %s > nul' % ip) | |
can_ping = True if ret == 0 else False | |
return can_ping, ip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __PYTHON_LIKE__ | |
#define __PYTHON_LIKE__ | |
#include <stdio.h> | |
#include <string> | |
#include <fstream> | |
#include <streambuf> | |
#include <vector> | |
#include <iostream> | |
#include <stdarg.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wave | |
import os | |
def is_wav(f): | |
res = True | |
try: | |
wave.open(f) | |
except wave.Error as e: | |
res = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import librosa | |
import wave | |
from pathlib import Path | |
import numpy as np | |
import os | |
all_in_one_wav = "@all_in_one.wav" | |
all_in_one_wav_info = "@all_in_one.txt" | |
all_in_one_label = "@all_in_one_vad.txt" | |
label_file = "@label.txt" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bob.io.audio | |
import bob.kaldi # https://www.idiap.ch/software/bob/docs/bob/docs/stable/bob/doc/install.html | |
import matplotlib.pyplot as plt | |
def vad(sig, sr, vad_energy_mean_scale=0.5, vad_energy_th=9, vad_frames_context=20, vad_proportion_th=0.4): | |
""" Energy Based Voice Activate Detection algorithm. (based on kaldi) | |
Param: | |
sig: list or np.array | |
the signal, list of samples | |
sr: int |