faustomorales / keras-ocr

A packaged and flexible version of the CRAFT text detector and Keras CRNN recognition model.
https://keras-ocr.readthedocs.io/
MIT License
1.39k stars 360 forks source link

Fine tunning recognizer IAM Handwriting dataset #132

Open RickyGunawan09 opened 3 years ago

RickyGunawan09 commented 3 years ago

Hello. I have a question about fine tunning using the IAM handwriting dataset. do I have to fine-tuning the detector too?

when I want to run the training process I get this error message.

Epoch 1/1000 2510/10257 [======>.......................] - ETA: 6:57 - loss: 11.6869

UnknownError Traceback (most recent call last)

in () 10 validation_data=validation_gen, 11 callbacks=callbacks, ---> 12 epochs=1000, 13 ) 10 frames /usr/local/lib/python3.6/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name) 58 ctx.ensure_initialized() 59 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, ---> 60 inputs, attrs, num_outputs) 61 except core._NotOkStatusException as e: 62 if name is not None: UnknownError: 2 root error(s) found. (0) Unknown: error: OpenCV(4.4.0) /tmp/pip-req-build-qacpj5ci/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/script_ops.py", line 244, in __call__ ret = func(*args) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/autograph/impl/api.py", line 302, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 827, in generator_py_func values = next(generator_state.get_iterator(iterator_id)) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 814, in wrapped_generator for data in generator_fn(): File "/usr/local/lib/python3.6/dist-packages/keras_ocr/recognition.py", line 361, in get_batch_generator batch = [sample for sample, _ in zip(image_generator, range(batch_size))] File "/usr/local/lib/python3.6/dist-packages/keras_ocr/recognition.py", line 361, in batch = [sample for sample, _ in zip(image_generator, range(batch_size))] File "/usr/local/lib/python3.6/dist-packages/keras_ocr/datasets.py", line 395, in get_recognizer_image_generator cval=cval) File "/usr/local/lib/python3.6/dist-packages/keras_ocr/tools.py", line 407, in read_and_fit image = read(filepath_or_array) if isinstance(filepath_or_array, str) else filepath_or_array File "/usr/local/lib/python3.6/dist-packages/keras_ocr/tools.py", line 36, in read return cv2.cvtColor(image, cv2.COLOR_BGR2RGB) cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-qacpj5ci/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' [[{{node PyFunc}}]] [[IteratorGetNext]] (1) Unknown: error: OpenCV(4.4.0) /tmp/pip-req-build-qacpj5ci/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/script_ops.py", line 244, in __call__ ret = func(*args) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/autograph/impl/api.py", line 302, in wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/data/ops/dataset_ops.py", line 827, in generator_py_func values = next(generator_state.get_iterator(iterator_id)) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 814, in wrapped_generator for data in generator_fn(): File "/usr/local/lib/python3.6/dist-packages/keras_ocr/recognition.py", line 361, in get_batch_generator batch = [sample for sample, _ in zip(image_generator, range(batch_size))] File "/usr/local/lib/python3.6/dist-packages/keras_ocr/recognition.py", line 361, in batch = [sample for sample, _ in zip(image_generator, range(batch_size))] File "/usr/local/lib/python3.6/dist-packages/keras_ocr/datasets.py", line 395, in get_recognizer_image_generator cval=cval) File "/usr/local/lib/python3.6/dist-packages/keras_ocr/tools.py", line 407, in read_and_fit image = read(filepath_or_array) if isinstance(filepath_or_array, str) else filepath_or_array File "/usr/local/lib/python3.6/dist-packages/keras_ocr/tools.py", line 36, in read return cv2.cvtColor(image, cv2.COLOR_BGR2RGB) cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-qacpj5ci/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' [[{{node PyFunc}}]] [[IteratorGetNext]] [[functional_9/lambda_1/MatMul_1/_54]] 0 successful operations. 0 derived errors ignored. [Op:__inference_train_function_15145] Function call stack: train_function -> train_function can anyone tell me what's wrong here? thank you. @faustomorales
fingoldo commented 3 years ago

Could be just a damaged file. Try to skip that particular file and see if it helps...

ezzaimsoufiane commented 3 years ago

have the same problem. i think this is also related to this issue #115