Skip to content
Snippets Groups Projects

Compute confidence scores by char, word or line

Merged Solene Tarride requested to merge 33-compute-confidence-scores-by-char-word-or-line into main
All threads resolved!
1 file
+ 17
22
Compare changes
  • Side-by-side
  • Inline
+ 17
22
# Predict
## Description
Use the `teklia-dan predict` command to predict a trained DAN model on an image.
| Parameter | Description | Type | Default |
| ------------------------------ | ---------------------------------------------------------------------------- | -------- | ------- |
| `--image` | Path to the image to predict. | `Path` | |
| `--model` | Path to the model to use for prediction | `Path` | |
| `--parameters` | Path to the YAML parameters file. | `Path` | |
| `--charset` | Path to the charset file. | `Path` | |
| `--output` | Path to the output folder. Results will be saved in this directory. | `Path` | |
| `--scale` | Image scaling factor before feeding it to DAN. | `float` | 1.0 |
| `--confidence-score` | Whether to return confidence scores. | `bool` | False |
| `--attention-map` | Whether to plot attention maps. | `bool` | False |
| `--attention-map-level` | Level to plot the attention maps. Should be in `["line", "word", "char"]`. | `str` | line |
| `--attention-map-scale` | Image scaling factor before creating the GIF. | `float` | 0.5 |
## Description of parameters
| Parameter | Description | Type | Default |
| --------------------------- | -------------------------------------------------------------------------------------------- | ------- | ------------- |
| `--image` | Path to the image to predict. | `Path` | |
| `--model` | Path to the model to use for prediction | `Path` | |
| `--parameters` | Path to the YAML parameters file. | `Path` | |
| `--charset` | Path to the charset file. | `Path` | |
| `--output` | Path to the output folder. Results will be saved in this directory. | `Path` | |
| `--scale` | Image scaling factor before feeding it to DAN. | `float` | `1.0` |
| `--confidence-score` | Whether to return confidence scores. | `bool` | `False` |
| `--confidence-score-levels` | Level to return confidence scores. Should be any combination of `["line", "word", "char"]`. | `str` | |
| `--attention-map` | Whether to plot attention maps. | `bool` | `False` |
| `--attention-map-scale` | Image scaling factor before creating the GIF. | `float` | `0.5` |
| `--attention-map-level` | Level to plot the attention maps. Should be in `["line", "word", "char"]`. | `str` | `"line"` |
| `--word-separators` | List of word separators. | `list` | `[" ", "\n"]` |
| `--line-separators` | List of line separators. | `list` | `["\n"]` |
## Examples
@@ -101,10 +103,3 @@ It will create the following JSON file named `dan_humu_page/predict/example.json
<video autoplay>
<source src="../assets/example_word.gif">
</video>
## Remarks
The script plotting attention maps assumes that:
* words are separated with the symbol ` `
* lines are separated with the symbol `\n`
Loading