Skip to content

Command line tools

Belos Thomas edited this page Aug 2, 2018 · 1 revision

How to recognize a page of text ?

Please make sure that the checkpoints .pth.tar files is present under the checkpoints folder, and make sur that the settings.cfg file correspond to yout model.

You can download some trained models and copy it to the checkpoints folder : Download on DropBox

Then you can run :

./launch recognizer [your files] [your folders] ...

to extract the text of your images.

How to train/test with command line

Settings up the database

The first thinks you have to do before a training is to setup the datasets.

Modify the file datasets.cfg so it correspond to your data-sets. Currently, SOCR is compatible with the IAM Datasets and ICDAR Datasets. See datasets.example.cfg for a example.

How to train/test the line recognizer ?

Execute :

./launch line --model dhSegment --name myDhSegmentTraining --bs 8 --lr 0.0001

./launch text --model resSru --name myResSruTraining --bs 8 --lr 0.0001

to train the line localizator or the line recognizer. Change the parameters to whatever you want. Use ./launch line --help for more help. You can also modifiy the file settings.cfg for more configuration.

Auto-saving

You can select a model using the --model [MODEL] argument, and give a custom name to a model by using --name argument. When CTRL-C is pressed, the program will ask you to save the weight or not. The weights are saved under the checkpoints folder, with the given name as argument, or with the model name if no name is specified. The programe will automatically load the good model.

In case of problem, a backup of the weights are made with the extension .autosave under the checkpoints folder.

Multi-GPU

Use CUDA_VISIBLE_DEVICES=0,1 to select the available GPU. SOCR will use all available GPU if you are training, or one GPU if you only evaluate. The batch size need to be a multiple of the number of GPU.

Warning : SRU use a lot of power, and can exceed the maximum power indicated by NVIDIA. Please make sure that your power supply is enough good. If it is not, your PC may crash.