How to calculate ctc probability for given input and expected output?
according to Graves paper [1], the loss for a batch is defined as sum(log(p(z|x))) over all samples (x,z) in this batch.
If you use a batch size of 1, you get log(p(z|x)), that is the log-probability of seeing the labelling z given the input x. This can be achieved with the ctc_loss function from TensorFlow.
You can also implement the relevant parts of the Forward-Backward Algorithm described in Section 4.1 of the paper [1] yourself.
For small input sequences it is feasible to use a naive implementation by constructing the paths shown in Figure 3 and then sum over all that paths in the RNN output.
I did this for a sequence of length 16 and for a sequence of length 100. For the former one the naive approach was sufficient while for the latter one the presented dynamic programming approach was needed.
[1] Connectionist Temporal Classification: Labelling Unsegmented Sequence Data with Recurrent Neural Networks
I'm doing my first tensorflow project.
I need to get ctc probability (not ctc loss) for given input and my expected sequences.
Is there any api or ways to do it in python or c++?
I prefer python side, but c++ side is also okay.