What's new? |
pytorch 1.2.0, pillow version - 컴퓨터 |
if you see "ImportError: cannot import name 'PILLOW_VERSION'" during running PyTorch 1.2.0 scripts then downgrade pillow to 6.2.1.
ref: https://github.com/python-pillow/Pillow/issues/4130
ref: https://github.com/python-pillow/Pillow/issues/4130
written time : 2020-04-30 14:26:42.0
표현 - 영어공부 |
from https://www.youtube.com/watch?v=2Kawrd5szHE
"Videos of this quality on this subject are a rare occurrence . Great job!"
"Videos of this quality on this subject are a rare occurrence . Great job!"
written time : 2020-04-17 20:59:02.0
naive but intuitive(kaldi): saving cmvn(fbank+deltadelta) to npy - 컴퓨터 |
#!/bin/bash
#0. prep using kaldi script
#spk2utt, utt2spk
#wav.scp
#1. fbank for all utterance + utt2spk
compute-fbank-feats --num-mel-bins=80 --sample-frequency=16000 --use-log-fbank=True scp:wav.scp ark:- | add-deltas ark:- ark,scp:feats.ark,feats.scp
#2. cmvn using fbank feats and utt2spk
compute-cmvn-stats --spk2utt=ark:spk2utt scp:feats.scp ark,scp:cmvn.ark,cmvn.scp
apply-cmvn --utt2spk=ark:utt2spk scp:cmvn.scp scp:feats.scp ark,scp:normed_feats.ark,normed_feat.scp
#3. save cmvn applied fbanks to npy
copy-feats scp:normed_feat.scp ark,t:normed_feats.txt
python3 parsing.py normed_feats.txt
parsing.py
import os
i mport sys
import numpy as np
feat_path = open(sys.argv[1])
status = 0
utt_id = ""
feats = ""
idx = 0
for line in feat_path:
if status == 0 and "[" in line:
idx += 1
print(idx)
utt_id = line.strip().split()[0]
status = 1
elif status == 1:
feats += line.replace("]","").strip() + "
"
if "]" in line:
with open(utt_id + ".npy.txt","w") as npy_file:
npy_file.write(feats.strip())
np.save(utt_id + ".npy", np.loadtxt(utt_id + ".npy.txt"))
os.remove(utt_id + ".npy.txt")
status = 0
feats = ""
utt_id = ""
feat_path.close()
#0. prep using kaldi script
#spk2utt, utt2spk
#wav.scp
#1. fbank for all utterance + utt2spk
compute-fbank-feats --num-mel-bins=80 --sample-frequency=16000 --use-log-fbank=True scp:wav.scp ark:- | add-deltas ark:- ark,scp:feats.ark,feats.scp
#2. cmvn using fbank feats and utt2spk
compute-cmvn-stats --spk2utt=ark:spk2utt scp:feats.scp ark,scp:cmvn.ark,cmvn.scp
apply-cmvn --utt2spk=ark:utt2spk scp:cmvn.scp scp:feats.scp ark,scp:normed_feats.ark,normed_feat.scp
#3. save cmvn applied fbanks to npy
copy-feats scp:normed_feat.scp ark,t:normed_feats.txt
python3 parsing.py normed_feats.txt
parsing.py
import os
i mport sys
import numpy as np
feat_path = open(sys.argv[1])
status = 0
utt_id = ""
feats = ""
idx = 0
for line in feat_path:
if status == 0 and "[" in line:
idx += 1
print(idx)
utt_id = line.strip().split()[0]
status = 1
elif status == 1:
feats += line.replace("]","").strip() + "
"
if "]" in line:
with open(utt_id + ".npy.txt","w") as npy_file:
npy_file.write(feats.strip())
np.save(utt_id + ".npy", np.loadtxt(utt_id + ".npy.txt"))
os.remove(utt_id + ".npy.txt")
status = 0
feats = ""
utt_id = ""
feat_path.close()
written time : 2020-03-27 12:55:01.0