-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: Layer 'conv2d_9' expected 1 variables, but received 0 variables during loading. Expected: ['conv2d_9/kernel:0'] #1792
Comments
Hi @MuhammadShifa 👋, Thanks for reporting this seems to be an issue with TensorFlow on Windows machines -> #1776 CC @odulcy-mindee Do we have a windows machine where we can try to reproduce the bug ? 😅 With linux everything works as expected -> CI also green |
Hi @felixdittrich92 , @odulcy-mindee |
Quickly tested also with py3.11 in a docker container without issues. |
Currently have the same problem whenever i try to run the ocr_predictor. Any current alternative fix? |
Hi @JulianAndhika 👋🏼 , I expect you use also windows ? What you could do is switching to PyTorch as backend btw. which docTR version do you use ? |
Yeah im using windows. I'm currently trying to use OnnxTR as an alternative. I'm currently fine tuning the model using train_tensorflow.py, and was wondering if i could do the same thing on OnnxTR. Also i was using docTR version 0.10.0 |
OnnxTR is inference only so you can train / fine tune your model with docTR and export it to Onnx as described here: |
Quick update: I was able to reproduce the issue and as suspected it's a bug in Keras (v2) - happens only on Windows |
Hi @felixdittrich92 @felixT2K. That's unfortunate, hopefully the bug could be fixed soon. I've resorted to fine tune the model on colab, since it doesn't seem to be running into the bug when fine tuning. Using pytorch is fine for inference, but when i try fine tuning, it produces an error of
Maybe a bug on pytorch part or something i don't know. Any ideas on what's wrong? |
@MuhammadShifa The pytorch bug (it's not really a bug) is easy to fix your recognition dataset contains samples with more than 32 characters (models max_length) - so keep only samples with <= 30 characters (because EOS + SOS will be added on top so + 2) and everything should work as expected Additional don't miss to pass the correct vocab for training / fine tuning (feel free to share the command you use to start training) |
Bug description
Hello thanks for the awesome package. I am going to process a pdf document with OCR but I am facing the issue in Window Machine. I have installed the doctr, tf and pt from source via the following line.
Code snippet to reproduce the bug
Traceback (most recent call last):
File "E:\OCR\ml_mo\doctr_mo\testing_doct.py", line 5, in
model = kie_predictor(det_arch='db_resnet50', reco_arch='crnn_vgg16_bn', pretrained=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\OCR\ml_mo\doctr\doctr\models\zoo.py", line 228, in kie_predictor
return _kie_predictor(
^^^^^^^^^^^^^^^
File "E:\OCR\ml_mo\doctr\doctr\models\zoo.py", line 146, in _kie_predictor
det_predictor = detection_predictor(
^^^^^^^^^^^^^^^^^^^^
File "E:\OCR\ml_mo\doctr\doctr\models\detection\zoo.py", line 110, in detection_predictor
return _predictor(
^^^^^^^^^^^
File "E:\OCR\ml_mo\doctr\doctr\models\detection\zoo.py", line 50, in _predictor
_model = detection.dict[arch](
^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\OCR\ml_mo\doctr\doctr\models\detection\differentiable_binarization\tensorflow.py", line 390, in db_resnet50
return _db_resnet(
^^^^^^^^^^^
File "E:\OCR\ml_mo\doctr\doctr\models\detection\differentiable_binarization\tensorflow.py", line 318, in _db_resnet
load_pretrained_params(
File "E:\OCR\ml_mo\doctr\doctr\models\utils\tensorflow.py", line 73, in load_pretrained_params
model.load_weights(archive_path, skip_mismatch=skip_mismatch)
File "C:\Users\admin\anaconda3\envs\doctr_ocr\Lib\site-packages\tf_keras\src\utils\traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\admin\anaconda3\envs\doctr_ocr\Lib\site-packages\tf_keras\src\engine\base_layer.py", line 3518, in load_own_variables
raise ValueError(
ValueError: Layer 'conv2d_9' expected 1 variables, but received 0 variables during loading. Expected: ['conv2d_9/kernel:0']
The text was updated successfully, but these errors were encountered: