in my project, i try my project with cnn+lstm+ctc net
i start my module with mod
mx.mod.BucketingModule(sym_gen, default_bucket_key=data_train.default_bucket_key, context=contexts)
and the model is train succeed, but in prediction stage, i try
mx.model.load_checkpoint(modelPrefix, 50) :Cannot find Operator WarpCTC in registry
mxnet_predict Predictor : "'Predictor' object has no attribute 'handle'" in
but all not succeed,
how do i wirte the bucketing prediction python code ?
thanks!
When you do prediction, you can replace it with softmax and do some post processing. The predicting is almost the same as the training.
What is the error you have now and can you post your symbol here?
For those parameters, it depends on how you compute them. What is you input image size?
When you do predict you actually don't know the label shape. The default bucket key is used in training to allocate the memory. And bucket_key describes the shape your data.
For example. if you want to predict a image of shape 300x30 with 100x1 as the input shape for lstm. You can have data_shape as 300x30 and bucket_key of 100 which tells how long the lstm is. The CTC is replaced with softmax in prediction.
The bucket key of my code contains two parts. 1st is the warpCTC label length, 2nd is the lstm sequence length. Since you don't know the label length during testing, your bucket_key only represents the lstm sequence length. I suggest you to write another symbol for testing but shares same symbol names for those layers with parameters.
@Godricly i load the parameter successful, but in the step of
self.predictor.bind(self.data_shapes, self.label_shapes,for_training=False)
in BucketingModule data_shapes is a vary length sequence, what data_shapes for the input of bind?
@Godricly thans, i think i finished the problem! thanks very much !
@sunspring320 i have the same problem, in project https://github.com/sunspring320/mxnet-cnn-lstm-ctc-ocr, how to construct the predict code, have you finished?
Most helpful comment
@Godricly thans, i think i finished the problem! thanks very much !