Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iam #2658

Merged
merged 38 commits into from
Sep 12, 2018
Merged

Iam #2658

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a3a18e2
adding changes for language modelling
aarora8 Aug 30, 2018
91508b5
adding modifications for augmentation, topology, shearing, run.sh
aarora8 Aug 31, 2018
5f273d6
fixing bugs
aarora8 Aug 31, 2018
2645f14
fixing bug
aarora8 Aug 31, 2018
6ebfdb2
adding parameter tuning
aarora8 Sep 1, 2018
b532978
cosmetic fixes and updating results
aarora8 Sep 1, 2018
f383334
cosmetic fixes
aarora8 Sep 1, 2018
44c9e58
adding results
aarora8 Sep 1, 2018
2d11672
removing local/prepare_lang and adding gen_topo in run.sh
aarora8 Sep 1, 2018
4fc6705
fixing bugs
aarora8 Sep 1, 2018
8877530
updating result
aarora8 Sep 2, 2018
59e2c8b
updating documentation, results and parameter tuning
aarora8 Sep 2, 2018
5fc0d17
fixing chain scripts
aarora8 Sep 2, 2018
1138ee3
updating parameters
aarora8 Sep 2, 2018
b3532ce
updating parameters and results
aarora8 Sep 3, 2018
9b67d9d
adding overwrite option and punctuation topology
aarora8 Sep 3, 2018
89c9ec7
adding overwrite option
aarora8 Sep 4, 2018
c05cd4d
adding aachen splits
aarora8 Sep 4, 2018
5dfe8fc
fixing bugs
aarora8 Sep 4, 2018
d7448df
modification from review
aarora8 Sep 5, 2018
d7d5c22
updating parameter and result
aarora8 Sep 6, 2018
43e9af9
updating parameter and result
aarora8 Sep 6, 2018
17c506b
adding data preprocessing in test and val
aarora8 Sep 7, 2018
d640742
updating results
aarora8 Sep 7, 2018
7dfd0b5
Merge branch 'master' of https://github.com/kaldi-asr/kaldi into iam_4
aarora8 Sep 7, 2018
94a80ad
replacing prepend words with common prepend words
aarora8 Sep 7, 2018
711c3c9
updating remove_test_utterances_from_lob for aachen split
aarora8 Sep 7, 2018
5f2d960
removing data/val/text from train_lm
aarora8 Sep 7, 2018
7f2ad0b
cosmetic fixes in unk arc decoding
aarora8 Sep 7, 2018
8f2ac25
adding val data for decoding
aarora8 Sep 7, 2018
b8e71b2
modification from the review
aarora8 Sep 10, 2018
e9a75f6
modification from review
aarora8 Sep 10, 2018
ae674ed
modification from review
aarora8 Sep 10, 2018
7651f37
modification for downloading aachen splits
aarora8 Sep 10, 2018
417d97c
fixing bug in rescoring
aarora8 Sep 11, 2018
6a86531
hardcoding for removing only remaining long utterence
aarora8 Sep 12, 2018
ba07ff0
fix in hardcoding
aarora8 Sep 12, 2018
5398412
modification from review
aarora8 Sep 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adding aachen splits
  • Loading branch information
aarora8 committed Sep 4, 2018
commit c05cd4df19953c65f76c09827ffa47513aa6953c
18 changes: 9 additions & 9 deletions egs/iam/v2/local/prepare_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,16 @@ cat $train_old > $train_new
cat $test_old > $test_new
cat $val1_old $val2_old > $val_new

if [ $stage -le 0 ]; then
if [ ! -f data/train/text ] || $overwrite; then
if $process_aachen_split; then
local/process_aachen_splits.py data/local aachen_split data/train --dataset train || exit 1
local/process_aachen_splits.py data/local aachen_split data/test --dataset test || exit 1
local/process_aachen_splits.py data/local aachen_split data/val --dataset validation || exit 1
else
local/process_data.py data/local data/train --dataset train || exit 1
local/process_data.py data/local data/test --dataset test || exit 1
local/process_data.py data/local data/val --dataset validation || exit 1

image/fix_data_dir.sh data/train
image/fix_data_dir.sh data/test
image/fix_data_dir.sh data/val
else
echo "Not processing data since it is already processed"
fi
fi

image/fix_data_dir.sh data/train
image/fix_data_dir.sh data/test
image/fix_data_dir.sh data/val
88 changes: 88 additions & 0 deletions egs/iam/v2/local/process_aachen_splits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/usr/bin/env python3

# Copyright 2017 Chun Chieh Chang
# 2017 Ashish Arora

""" This script reads the extracted IAM database files and creates
the following files (for the data subset selected via --dataset):
text, utt2spk, images.scp.

Eg. local/process_aachen_splits.py data/local data/train data --dataset train
Eg. text file: 000_a01-000u-00 A MOVE to stop Mr. Gaitskell from
utt2spk file: 000_a01-000u-00 000
images.scp file: 000_a01-000u-00 data/local/lines/a01/a01-000u/a01-000u-00.png
"""

import argparse
import os
import sys
import xml.dom.minidom as minidom

parser = argparse.ArgumentParser(description="""Creates text, utt2spk
and images.scp files.""")
parser.add_argument('database_path', type=str,
help='Path to the downloaded (and extracted) IAM data')
parser.add_argument('split_path', type=str,
help='location of the train/test/val set')
parser.add_argument('out_dir', type=str,
help='location to write output files.')
parser.add_argument('--dataset', type=str, default='train',
choices=['train_list', 'dev_list', 'eval_list'],
help='Subset of data to process.')
args = parser.parse_args()

text_file = os.path.join(args.out_dir + '/', 'text')
text_fh = open(text_file, 'w')

utt2spk_file = os.path.join(args.out_dir + '/', 'utt2spk')
utt2spk_fh = open(utt2spk_file, 'w')

image_file = os.path.join(args.out_dir + '/', 'images.scp')
image_fh = open(image_file, 'w')

dataset_path = os.path.join(args.split_path,
args.dataset + '.txt')

text_file_path = os.path.join(args.database_path,
'ascii','lines.txt')
text_dict = {}
def process_text_file_for_word_model():
with open (text_file_path, 'rt') as in_file:
for line in in_file:
if line[0]=='#':
continue
line = line.strip()
utt_id = line.split(' ')[0]
text_vect = line.split(' ')[8:]
text = "".join(text_vect)
text = text.replace("|", " ")
text_dict[utt_id] = text


### main ###

print("Processing '{}' data...".format(args.dataset))
process_text_file_for_word_model()

with open(dataset_path) as f:
for line in f:
line = line.strip()
line_vect = line.split('-')
xml_file = line_vect[0] + '-' + line_vect[1]
xml_path = os.path.join(args.database_path, 'xml', xml_file + '.xml')
doc = minidom.parse(xml_path)
form_elements = doc.getElementsByTagName('form')[0]
writer_id = form_elements.getAttribute('writer-id')
outerfolder = form_elements.getAttribute('id')[0:3]
innerfolder = form_elements.getAttribute('id')
lines_path = os.path.join(args.database_path, 'lines',
outerfolder, innerfolder)
for file in os.listdir(lines_path):
if file.endswith(".png"):
image_file_path = os.path.join(lines_path, file)
base_name = os.path.splitext(os.path.basename(image_file_path))[0]
text = text_dict[base_name]
utt_id = writer_id + '_' + base_name
text_fh.write(utt_id + ' ' + text + '\n')
utt2spk_fh.write(utt_id + ' ' + writer_id + '\n')
image_fh.write(utt_id + ' ' + image_file_path + '\n')
1 change: 0 additions & 1 deletion egs/iam/v2/local/process_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def process_text_file_for_word_model():
xml_path = os.path.join(args.database_path, 'xml', xml_file + '.xml')
img_num = line[-3:]
doc = minidom.parse(xml_path)

form_elements = doc.getElementsByTagName('form')[0]
writer_id = form_elements.getAttribute('writer-id')
outerfolder = form_elements.getAttribute('id')[0:3]
Expand Down