Difference between revisions of "HTR"

From Transkribus Wiki
Jump to: navigation, search
(Training)
(Training)
Line 20: Line 20:
  
 
<pre>
 
<pre>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<uroHtrTrainConfig>
+
<uroHtrTrainConfig>
    <modelName>Test Model</modelName>
+
    <modelName>Test Model</modelName>
    <description>A description</description>
+
    <description>A description</description>
    <language>German</language>
+
    <language>German</language>
    <colId>2</colId>
+
    <colId>2</colId>
            <numEpochs>200</numEpochs>
+
    <numEpochs>200</numEpochs>
    <learningRate>2e-3</learningRate>
+
    <learningRate>2e-3</learningRate>
    <noise>both</noise>
+
    <noise>both</noise>
    <trainSizePerEpoch>1000</trainSizePerEpoch>
+
    <trainSizePerEpoch>1000</trainSizePerEpoch>
    <TrainList>
+
    <TrainList>
        <train>
+
        <train>
            <docId>1</docId>
+
            <docId>1</docId>
            <pageList>
+
            <pageList>
                <pages>
+
                <pages>
                    <pageId>1</pageId>
+
                    <pageId>1</pageId>
                    <tsId>1</tsId>
+
                    <tsId>1</tsId>
                </pages>
+
                </pages>
                <pages>
+
                <pages>
                    <pageId>2</pageId>
+
                    <pageId>2</pageId>
                    <tsId>2</tsId>
+
                    <tsId>2</tsId>
                </pages>
+
                </pages>
            </pageList>
+
            </pageList>
        </train>
+
        </train>
        <train>
+
        <train>
            <docId>2</docId>
+
            <docId>2</docId>
            <pageList>
+
            <pageList>
                <pages>
+
                <pages>
                    <pageId>3</pageId>
+
                    <pageId>3</pageId>
                    <tsId>3</tsId>
+
                    <tsId>3</tsId>
                </pages>
+
                </pages>
                <pages>
+
                <pages>
                    <pageId>4</pageId>
+
                    <pageId>4</pageId>
                    <tsId>4</tsId>
+
                    <tsId>4</tsId>
                </pages>
+
                </pages>
            </pageList>
+
            </pageList>
        </train>
+
        </train>
    </TrainList>
+
    </TrainList>
    <TestList/>
+
    <TestList/>
</uroHtrTrainConfig>
+
</uroHtrTrainConfig>
 
</pre>
 
</pre>

Revision as of 13:46, 19 December 2016

Training

For training a new HTR model using the new API, at first a configuration XML has to be created. Besides parameters (the example below includes the default values) mandatory fields are:

  • a model name
  • a description
  • the language
  • the collection ID where the input documents can be found

The input for training is described in the TrainList section of the XML and is made up of train elements where each includes:

  • the document ID
  • a list of pages where each page includes
    • the page-ID
    • the ID of the transcript version that should be used for training

Optionally a test set can be specified in the TestList element analogously.

The training descriptor then should look like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<uroHtrTrainConfig>
    <modelName>Test Model</modelName>
    <description>A description</description>
    <language>German</language>
    <colId>2</colId>
    <numEpochs>200</numEpochs>
    <learningRate>2e-3</learningRate>
    <noise>both</noise>
    <trainSizePerEpoch>1000</trainSizePerEpoch>
    <TrainList>
        <train>
            <docId>1</docId>
            <pageList>
                <pages>
                    <pageId>1</pageId>
                    <tsId>1</tsId>
                </pages>
                <pages>
                    <pageId>2</pageId>
                    <tsId>2</tsId>
                </pages>
            </pageList>
        </train>
        <train>
            <docId>2</docId>
            <pageList>
                <pages>
                    <pageId>3</pageId>
                    <tsId>3</tsId>
                </pages>
                <pages>
                    <pageId>4</pageId>
                    <tsId>4</tsId>
                </pages>
            </pageList>
        </train>
    </TrainList>
    <TestList/>
</uroHtrTrainConfig>