Closed ChWick closed 4 years ago
thank you for the detailed analysis. I hope that I will soon have time to look at it.
Best, Harald
still didn't had the time to look at this in more detail. However, your analysis seems reasonable, so I merged it. Thanks for your contribution :+1: . For reasons of consistency I changed the blank index back to the (fixed) last position in the RNN output.
I got several problems on rather trivial dictionaries and charsets (see below):
Without pull-request:
With pull-request (as expected):
Test code (copy the snipped in
TokenPassing.py
and use all files in the appendix)greedy
from itertools import groupby best_path = np.argmax(probabilities, axis=1) blank_idx = 0 best_charscollapsed = [classes[k] for k, in groupby(best_path) if k != blank_idx] res = ' '.join(best_chars_collapsed) print("Greedy-Decoder: ", res)
token passing
tp = ctcTokenPassing(probabilities, classes, dictionary, blankIdx=blank_idx) print("Token-Passing: ", tp)
import matplotlib.pyplot as plt plt.imshow(np.log(probabilities)) plt.show()