tensorflow-ctc-speech-recognition icon indicating copy to clipboard operation
tensorflow-ctc-speech-recognition copied to clipboard

modify for many classes (many char)

Open dangvansam opened this issue 5 years ago • 0 comments

i want to train with many char. not use ord(), how can map char (ex map by a dict) charmap_en1 = {'t': 20, 'v': 22, 'u': 21, 'z': 26, 'y': 25, 'f': 6, 'p': 16, 'x': 24, 'h': 8, 'o': 15, 'k': 11, 'q': 17, 'w': 23, 'i': 9, 'm': 13, 'l': 12, 'c': 3, 's': 19, 'a': 1, 'b': 2, 'g': 7, 'e': 5, 'j': 10, 'r': 18, 'n': 14, 'd': 4} or charmap = {'ử': 84, 'í': 32, 'ỷ': 89, 'ặ': 57, 'ầ': 49, 'ọ': 68, 'm': 12, 'đ': 41, 'á': 25, 'ĩ': 42, 'ằ': 54, 'ẹ': 58, 's': 18, 'ễ': 64, 'b': 3, 'g': 7, 'ă': 40, 'ã': 27, 'ấ': 48, 'ể': 63, 'x': 22, 'c': 4, 'ẵ': 56, 'ợ': 79, 't': 19, 'y': 23, 'ỡ': 78, 'ờ': 76, 'v': 21, 'à': 24, 'r': 17, 'é': 29, 'ỗ': 73, 'a': 2, 'ụ': 80, 'n': 13, 'ở': 77, 'ẩ': 50, 'q': 16, 'â': 26, 'ữ': 85, 'ớ': 75, 'ổ': 72, 'ỉ': 66, 'ỏ': 69, 'ò': 33, 'è': 28, 'h': 8, 'ơ': 44, 'd': 5, 'o': 14, 'ệ': 65, 'e': 6, 'ô': 35, 'k': 10, 'p': 15, 'i': 9, 'ế': 61, 'ị': 67, 'ê': 30, 'ỹ': 90, 'ý': 39, 'ì': 31, 'ộ': 74, 'ỳ': 87, 'ề': 62, 'l': 11, 'ồ': 71, 'ắ': 53, 'ừ': 83, 'ỵ': 88, 'ả': 47, 'õ': 36, 'ó': 34, 'ạ': 46, 'ù': 37, 'ẻ': 59, 'ú': 38, 'ũ': 43, 'ư': 45, 'ủ': 81, 'ẫ': 51, 'ứ': 82, 'ẳ': 55, 'ậ': 52, 'ố': 70, 'ự': 86, 'u': 20, 'ẽ': 60} but in decode_batch() how change to replace 'blank' char, 'space' char by map not use ord() def decode_batch(d, original, phase='training'): aligned_original_string = '' aligned_decoded_string = '' for jj in range(batch_size)[0:2]: # just for visualisation purposes. we display only 2. values = d.values[np.where(d.indices[:, 0] == jj)[0]] print('d:',d.values) str_decoded = ''.join([chr(x) for x in np.asarray(values) + FIRST_INDEX]) # Replacing blank label to none str_decoded = str_decoded.replace(chr(ord('z') + 1), '') # Replacing space label to space str_decoded = str_decoded.replace(chr(ord('a') - 1), ' ') ........................................... thanks

dangvansam avatar Apr 12 '19 04:04 dangvansam