mmocr
mmocr copied to clipboard
How to train in text recognition by custom dataset?
Could anyone step by step share How to train in text recognition by custom dataset or example code ? It's actually described about training text recognition in mmocr_tutorial.ipynb. but when i do it. I found many problem such as type of labels file, split data train test and validation etc. I hope this question will make it easier for others to complete the project. and thank you for your answer.
MMOCR 0.x supports .txt, .json and .lmdb as the types of label files for text recognition. If you are trying to create your own dataset, it'd be better to start with the simplest txt format, where each line of the annotation is the combination of filename and the text annotation separated by a blank space.
img1.jpg OpenMMLab
img2.jpg MMOCR
If you want to include blank spaces in your annotation, you'll have to use jsonl format for annotations. Don't forget to change the parser arguments in the config's dataset field. Read the doc for more details.
As per splitting the dataset, there are no universally applicable rules for that. Usually, you can leave ~20% of the data for validation and testing. But the proportion depends on your dataset size and how well you hope the model to generalize on unseen data.
And finally, we have released the RCs for MMOCR 1.0, where the dataset format is unified into one to work for general OCR tasks, so you don't need to struggle with various formats for different cases. The aforementioned formats, of course, can still be loaded but just for the sake of compatibility. Docs The documentation for 1.0 will be much more complete and comprehensive compared to 0.x. You're welcome to check it out and leave any feedback to us :)
I'm looking for same things too. Tutorials in docs only explain about detection tasks, not recognition tasks.
@ProtossDragoon In the tutorial we have provided a toy example for recognition tasks: https://colab.research.google.com/github/open-mmlab/mmocr/blob/main/demo/MMOCR_Tutorial.ipynb#scrollTo=nYon41X7RTOT
Hello, I'm having the same problem, the link does not work anymore, where is the new one? And by the way @ProtossDragoon did you managed to train recognition in the end?
@xReniar We have updated the tutorial to this one: https://colab.research.google.com/github/open-mmlab/mmocr/blob/dev-1.x/demo/tutorial.ipynb#scrollTo=nYon41X7RTOT
Thank you!