MaybeShewill-CV / CRNN_Tensorflow

Convolutional Recurrent Neural Networks(CRNN) for Scene Text Recognition
MIT License
1.03k stars 388 forks source link

Support tflite #365

Closed sachaarbonel closed 4 years ago

sachaarbonel commented 4 years ago

Hi @MaybeShewill-CV , I'm trying to export your model in order to convert it to tflite but I'm facing this error :

Unable to open table file new-model/shadownet.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
     [[node save/RestoreV2 (defined at tfserve/export_saved_model.py:1042)  = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

Which version of tensorflow did you use for your trained model on Dropbox? My version is 1.12. Thank's for your incredible work on this.

MaybeShewill-CV commented 4 years ago

@Sach97 Use new-model/shadownet.ckpt instead:)

sachaarbonel commented 4 years ago

Thank's @MaybeShewill-CV , it fixed my previous issue but we still need to wait on Supporting control flow in TensorFlow Lite to be able to convert this model to tflite. There are also several operators that will need to be implemented on the client side : CTC_BEAM_SEARCH_DECODER, LoopCond, RandomUniform, TensorArrayGatherV3, TensorArrayReadV3, TensorArrayScatterV3, TensorArrayV3, TensorArrayWriteV3.

EDIT: I forgot to say that I opened an issue on tensorflow repo too.

sachaarbonel commented 4 years ago

I guess we can use Mozilla's : ctc_beam_search_decoder

MaybeShewill-CV commented 4 years ago

@Sach97 Once I've got spare time. I will check for this. You may also contribute on this. You're welcome to pull requests:)

sachaarbonel commented 4 years ago

@MaybeShewill-CV I would love to contribute to your project but I've some issues with the project setup it doesn't recognize the modules on any of my laptops (linux, macosx) like config and crnn_model. I haven't done any serious user facing project setup in python so don't quote me on this but I think we need a setup.py like crepe. I made a dirty workaround by copy pasting the modules in export_saved_model.py. Once I fix that maybe I'll be able to work on this. If you have sometime maybe we could schedule a 1:1 session on gitter.im or something to fix my environment ?

MaybeShewill-CV commented 4 years ago

@Sach97 You may set CRNN_PROJECT root dir in your PYTHONPATH:)

sachaarbonel commented 4 years ago

Thank's I'll try that

Jay-Kang1 commented 4 years ago

@Sach97 Use new-model/shadownet.ckpt instead:)

Where can I find the new-model/shadownet.ckpt ? I have the same problem when I test the pretrained models on your link