def write_preprocessed_target_data(_id: int, key: str, mel: np.ndarray,
                                   filename: str):
    raw_mel = mel.tostring()
    example = tf.train.Example(features=tf.train.Features(
        feature={
            'id': int64_feature([_id]),
            'key': bytes_feature([key.encode('utf-8')]),
            'mel': bytes_feature([raw_mel]),
            'target_length': int64_feature([len(mel)]),
            'mel_width': int64_feature([mel.shape[1]]),
        }))
    write_tfrecord(example, filename)
Example #2
0
def write_preprocessed_source_data(_id: int, key: str, source: np.ndarray,
                                   text, filename: str):
    raw_source = source.tostring()
    example = tf.train.Example(features=tf.train.Features(
        feature={
            'id': int64_feature([_id]),
            'key': bytes_feature([key.encode('utf-8')]),
            'source': bytes_feature([raw_source]),
            'source_length': int64_feature([len(source)]),
            'text': bytes_feature([text.encode('utf-8')]),
        }))
    write_tfrecord(example, filename)
Example #3
0
def write_preprocessed_target_data(_id: int, key: str, codes: np.ndarray,
                                   codes_length: int, lang, filename: str):
    raw_codes = codes.tostring()
    example = tf.train.Example(features=tf.train.Features(
        feature={
            'id': int64_feature([_id]),
            'key': bytes_feature([key.encode('utf-8')]),
            'lang': bytes_feature([lang.encode('utf-8')]),
            'codes': bytes_feature([raw_codes]),
            'codes_length': int64_feature([codes_length]),
            'codes_width': int64_feature([codes.shape[1]]),
        }))
    write_tfrecord(example, filename)
Example #4
0
def write_prediction_result(id_: int, key: str, alignments: List[np.ndarray], mel: np.ndarray,
                            ground_truth_mel: np.ndarray,
                            text: str, source: np.ndarray, filename: str):
    example = tf.train.Example(features=tf.train.Features(feature={
        'id': int64_feature([id_]),
        'key': bytes_feature([key.encode('utf-8')]),
        'mel': bytes_feature([mel.tostring()]),
        'mel_length': int64_feature([mel.shape[0]]),
        'mel_width': int64_feature([mel.shape[1]]),
        'ground_truth_mel': bytes_feature([ground_truth_mel.tostring()]),
        'ground_truth_mel_length': int64_feature([ground_truth_mel.shape[0]]),
        'alignment': bytes_feature([alignment.tostring() for alignment in alignments]),
        'text': bytes_feature([text.encode('utf-8')]),
        'source': bytes_feature([source.tostring()]),
        'source_length': int64_feature([source.shape[0]]),
    }))
    write_tfrecord(example, filename)
def write_preprocessed_source_data(_id: int, key: str, source: np.ndarray,
                                   text, phones: np.ndarray, phone_txt,
                                   speaker_id, age, gender, lang,
                                   filename: str):
    raw_source = source.tostring()
    example = tf.train.Example(features=tf.train.Features(
        feature={
            'id': int64_feature([_id]),
            'key': bytes_feature([key.encode('utf-8')]),
            'source': bytes_feature([raw_source]),
            'source_length': int64_feature([len(source)]),
            'text': bytes_feature([text.encode('utf-8')]),
            'phone': bytes_feature([phones.tostring()]),
            'phone_length': int64_feature([len(phones)]),
            'phone_txt': bytes_feature([phone_txt.encode('utf-8')]),
            'speaker_id': int64_feature([speaker_id]),
            'age': int64_feature([age]),
            'gender': int64_feature([gender]),
            'lang': bytes_feature([lang.encode('utf-8')]),
        }))
    write_tfrecord(example, filename)