githubharald / SimpleHTR

Handwritten Text Recognition (HTR) system implemented with TensorFlow.
https://towardsdatascience.com/2326a3487cd5
MIT License
1.96k stars 885 forks source link

AttributeError: `batch_normalization` is not available with Keras 3. #177

Closed View-my-Git-Lab-krafi closed 1 week ago

View-my-Git-Lab-krafi commented 1 week ago

python main.py --img_file ../data/line.png 2024-09-08 21:57:45.374897: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered 2024-09-08 21:57:45.385698: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered 2024-09-08 21:57:45.388847: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered 2024-09-08 21:57:45.397486: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2024-09-08 21:57:46.088878: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT Traceback (most recent call last): File "/home/krafi/Downloads/new/SimpleHTR/src/main.py", line 209, in main() File "/home/krafi/Downloads/new/SimpleHTR/src/main.py", line 204, in main model = Model(char_list_from_file(), decoder_type, must_restore=True, dump=args.dump) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/krafi/Downloads/new/SimpleHTR/src/model.py", line 43, in init self.setup_cnn() File "/home/krafi/Downloads/new/SimpleHTR/src/model.py", line 73, in setup_cnn conv_norm = tf.compat.v1.layers.batch_normalization(conv, training=self.is_train) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/krafi/.local/lib/python3.12/site-packages/tensorflow/python/util/lazy_loader.py", line 207, in getattr raise AttributeError( AttributeError: batch_normalization is not available with Keras 3.

githubharald commented 1 week ago

it's an old codebase, so you have to stick with a TF version that is still compatible with it. See requirements.txt for the list of compatible packages.