Closed Tailor2019 closed 3 years ago
Could you explain what you want to achieve a bit more in detail (e.g., additional code) right now, I can only guess your intentions.
In general, the architecture should not change. Set layer.trainable=False
on layers that shall not update their weights.
By default, Calamari allows to update all weights when loading a model since this resulted in better results compared to fine-tuning only the last layer.
Thanks for your reply! I try to train Calamari from scratch because my database is not a printed one then I don't obtain balanced model that recognise perfectly my database. For this reason I hope to use one of the existant pre-trained models and try to finetune this model. As we know Calamari architecture is CNN-BLSTM-CTC . My question is which layers shall in ""/calamari_ocr/ocr/backends/tensorflow_backend/tensorflow_model.py"" I freeze them and which layers keep open to modification?
Calamari is designed to support this out of the box:
calamari-train --files your_images.*.png --weights PATH_TO_PRETRAINED_MODEL
Calamari will load all weights and fine-tune on the provided data. By default, no layers are fixed, so keep all layers open for modification. You can try to fix all layers but the last one if you want to, but I dont recommend it for your usecase
Thanks so much! This will hardely help me.
You are welcome
Hello! @ChWick As described the architecture of the network described in "/calamari_ocr/ocr/backends/tensorflow_backend/tensorflow_model.py" I try to use one of the existant pretrained models :
Loaded_model="./antiqua_historical/" for layer in Loaded_model.layers[-""""Value""":]: layer.trainable = False which "value"" I can use to correctly finetune this model without changing the NN architecture? Thanks so much in advance.