|
|
@ -12,33 +12,32 @@ from deepspeech.utils.cli_utils import is_scipy_wav_style
|
|
|
|
def get_parser():
|
|
|
|
def get_parser():
|
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
description="convert feature to its shape",
|
|
|
|
description="convert feature to its shape",
|
|
|
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
|
|
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter, )
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument("--verbose", "-V", default=0, type=int, help="Verbose option")
|
|
|
|
"--verbose", "-V", default=0, type=int, help="Verbose option")
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
"--filetype",
|
|
|
|
"--filetype",
|
|
|
|
type=str,
|
|
|
|
type=str,
|
|
|
|
default="mat",
|
|
|
|
default="mat",
|
|
|
|
choices=["mat", "hdf5", "sound.hdf5", "sound"],
|
|
|
|
choices=["mat", "hdf5", "sound.hdf5", "sound"],
|
|
|
|
help="Specify the file format for the rspecifier. "
|
|
|
|
help="Specify the file format for the rspecifier. "
|
|
|
|
'"mat" is the matrix format in kaldi',
|
|
|
|
'"mat" is the matrix format in kaldi', )
|
|
|
|
)
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
"--preprocess-conf",
|
|
|
|
"--preprocess-conf",
|
|
|
|
type=str,
|
|
|
|
type=str,
|
|
|
|
default=None,
|
|
|
|
default=None,
|
|
|
|
help="The configuration file for the pre-processing",
|
|
|
|
help="The configuration file for the pre-processing", )
|
|
|
|
)
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
"rspecifier", type=str, help="Read specifier for feats. e.g. ark:some.ark"
|
|
|
|
"rspecifier",
|
|
|
|
)
|
|
|
|
type=str,
|
|
|
|
|
|
|
|
help="Read specifier for feats. e.g. ark:some.ark")
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
"out",
|
|
|
|
"out",
|
|
|
|
nargs="?",
|
|
|
|
nargs="?",
|
|
|
|
type=argparse.FileType("w"),
|
|
|
|
type=argparse.FileType("w"),
|
|
|
|
default=sys.stdout,
|
|
|
|
default=sys.stdout,
|
|
|
|
help="The output filename. " "If omitted, then output to sys.stdout",
|
|
|
|
help="The output filename. "
|
|
|
|
)
|
|
|
|
"If omitted, then output to sys.stdout", )
|
|
|
|
return parser
|
|
|
|
return parser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -64,8 +63,7 @@ def main():
|
|
|
|
# so change to file_reader_helper to return shape.
|
|
|
|
# so change to file_reader_helper to return shape.
|
|
|
|
# This make sense only with filetype="hdf5".
|
|
|
|
# This make sense only with filetype="hdf5".
|
|
|
|
for utt, mat in file_reader_helper(
|
|
|
|
for utt, mat in file_reader_helper(
|
|
|
|
args.rspecifier, args.filetype, return_shape=preprocessing is None
|
|
|
|
args.rspecifier, args.filetype, return_shape=preprocessing is None):
|
|
|
|
):
|
|
|
|
|
|
|
|
if preprocessing is not None:
|
|
|
|
if preprocessing is not None:
|
|
|
|
if is_scipy_wav_style(mat):
|
|
|
|
if is_scipy_wav_style(mat):
|
|
|
|
# If data is sound file, then got as Tuple[int, ndarray]
|
|
|
|
# If data is sound file, then got as Tuple[int, ndarray]
|
|
|
|