Does CRNN use sparse tensor value for its label?

I just read paper about cnn + rnn for text recognition. The labels of dataset is tensor of char index (e.g [0, 1, 2 ] for image with label "abc"). Since the label of each input has different length do I need to convert the label to sparse tensor value ? since the paper does not mention about it.

Topic ocr cnn rnn deep-learning

Category Data Science


My assumption here is that if the input vectors are of variable length, you should use something like keras.preprocessing.sequence.pad_sequences (as well as a masking layer to ignore these padded values) as a means of reformatting all input samples to the same size so that the input to your recurrent model meets the requirement of having a fixed num_timesteps length.
Function Documentation:

Pads sequences to the same length.

This function transforms a list of num_samples sequences (lists of integers) into a 2D Numpy array of shape (num_samples, num_timesteps). num_timesteps is either the maxlen argument if provided, or the length of the longest sequence otherwise.

Sequences that are shorter than num_timesteps are padded with value at the end.

Sequences longer than num_timesteps are truncated so that they fit the desired length. The position where padding or truncation happens is determined by the arguments padding and truncating, respectively.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.