tobiasvanderwerff / full-page-handwriting-recognition

Unofficial implementation of the paper "Full Page Handwriting Recognition via Image to Sequence Extraction" by Singh et al. (2021).
MIT License
51 stars 5 forks source link

TypeError: __init__() missing 1 required positional argument: 'normalize_params' #2

Closed amzker closed 2 years ago

amzker commented 2 years ago

Error

python3 inference.py --model_path ../models/version_5/checkpoints/epoch=1-char_error_rate=2.2459-word_error_rate=2.6578.ckpt --data_format form --img_path ../img/keller-handwriting.png

Traceback (most recent call last):
  File "inference.py", line 128, in <module>
    imgs, label_encoder = prepare_data(
  File "inference.py", line 98, in prepare_data
    trnsf = IAMImageTransforms(img.shape, data_format).test_trnsf
TypeError: __init__() missing 1 required positional argument: 'normalize_params'

i checked transform.py and it does need mean and SD as normalize_params at IAMImageTransform()

also in utils i found mean and sd 0.5,0.5, should i put this value in inference.py and let it go?

tobiasvanderwerff commented 2 years ago

Hi,

Looks like I did not update the inference.py script at some point. I would not use the default mean=0.5 and std=0.5 parameters, but rather the IAM-specific mean and standard deviation, as using normalization parameters different than those used during training can have serious effects on model performance. I will update the script to pass the proper normalization parameters.

Edit: I passed the wrong issue reference, but the last commit should fix the issue.