0
FC = mx.sym.FullyConnected(data=x_3,flatten=False, num_hidden=n_class)
x = mx.sym.softmax(data=FC)

sm_label = mx.sym.Reshape(data=label, shape=(-1,))
sm_label = mx.sym.Cast(data = sm_label, dtype = ‘int32’)
sm = mx.sym.WarpCTC(data=x, label=sm_label, label_length =n_len ,
input_length =rnn_length )

my x layer's shape[(32L, 35L, 27L)] (bacthsize,input_lenth,n_class)
label的shape[(32L,21L)] (batchsize,label_lenth)
warpctc
simple_bind error.
Arguments:
data: (32, 1L, 32L, 286L)
label: (32, 21L)
Error in operator warpctc48: Shape inconsistent, Provided = [672], inferred shape=[0,1]

What can I do?

sorak
  • 2,607
  • 2
  • 16
  • 24
Ming
  • 71
  • 1
  • 1
  • 6

1 Answers1

0

MXNet repo has a WarpCTC example here. You can run the training using python lstm_ocr_train.py --gpu 1 --num_proc 4 --loss warpctc font/Ubuntu-M.ttf. In the example, here are the shapes of prediction and label used with WarpCTC operator:

Prediction is (10240, 11)
Label is (512,)

label_length: 4
input_length: 80

batch_size = 128
seq_length = 80

In the above case,

  • Prediction is (batch_size*seq_length, n_class).
  • Label is (batch_size*label_length,).

Following along the lines of the example, I would suggest calling WarpCTC with prediction shape = (1120, 27), label shape = (672,), label_length = 21, input_length = 35 in your case.

Indhu Bharathi
  • 1,437
  • 1
  • 13
  • 22