mirror of
https://github.com/qurator-spk/eynollah.git
synced 2026-06-16 09:59:13 +02:00
training convert --rebuild for cnn-rnn-ocr: override charset file…
when rebuilding the inference model for cnn-rnn-ocr, - open the old `characters_org.txt` file for the charset - use it to pass the actual `n_classes` (overriding the config) - use its path to pass the `characters_txt_file` (overriding the config)
This commit is contained in:
parent
348ac95ad3
commit
4181e03bc9
1 changed files with 6 additions and 0 deletions
|
|
@ -68,6 +68,12 @@ def convert_cli(rebuild, format_, in_, out):
|
||||||
ex.add_config(str(config_path))
|
ex.add_config(str(config_path))
|
||||||
# some models deviate between training and inference
|
# some models deviate between training and inference
|
||||||
ex.add_config(inference=True)
|
ex.add_config(inference=True)
|
||||||
|
# make sure the local vocab file gets re-used
|
||||||
|
characters_txt_file = model_path / "characters_org.txt"
|
||||||
|
with open(characters_txt_file, "r") as voc_file:
|
||||||
|
voc = json.load(voc_file)
|
||||||
|
ex.add_config(characters_txt_file=characters_txt_file)
|
||||||
|
ex.add_config(n_classes=len(voc) + 3)
|
||||||
# just retrieve final config (via pseudo-run)
|
# just retrieve final config (via pseudo-run)
|
||||||
ex.main(lambda: 0)
|
ex.main(lambda: 0)
|
||||||
config = ex.run(options={'--loglevel': 'ERROR'}).config
|
config = ex.run(options={'--loglevel': 'ERROR'}).config
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue