janzd / CRNN

Convolutional recurrent neural network for scene text recognition or OCR in Keras
MIT License
122 stars 33 forks source link

Training model for Japanese Text facing this issue, please help #6

Open Zepharchit opened 4 years ago

Zepharchit commented 4 years ago

Traceback (most recent call last): File "train.py", line 96, in training_model.fit_generator(train_generator, steps_per_epoch=int(train_generator.nb_samples / train_generator.batch_size), epochs=cfg.nb_epochs, verbose=1, workers=cfg.nb_workers, use_multiprocessing=True, callbacks=callbacks) File "/home/eleven/ocr_keras/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/home/eleven/ocr_keras/lib/python3.6/site-packages/keras/engine/training.py", line 1732, in fit_generator initial_epoch=initial_epoch) File "/home/eleven/ocr_keras/lib/python3.6/site-packages/keras/engine/training_generator.py", line 100, in fit_generator callbacks.set_model(callback_model) File "/home/eleven/ocr_keras/lib/python3.6/site-packages/keras/callbacks/callbacks.py", line 68, in set_model callback.set_model(model) File "/home/eleven/ocr_keras/lib/python3.6/site-packages/keras/callbacks/tensorboard_v2.py", line 116, in set_model super(TensorBoard, self).set_model(model) File "/home/eleven/ocr_keras/lib/python3.6/site-packages/tensorflow_core/python/keras/callbacks.py", line 1532, in set_model self.log_dir, self.model._get_distribution_strategy()) # pylint: disable=protected-access AttributeError: 'Model' object has no attribute '_get_distribution_strategy'

janzd commented 4 years ago

It seems to be a compatibility issue between TF and Keras. Are you using TF v2? I only used this code in TF v1 so it doesn't include any features that are only in TF v2. You can either try it in TF v1 or if you want to use TF v2, you could try to change keras imports so that it imports tensorflow.keras instead. I found this issue with the same error message. https://github.com/googlecolab/colabtools/issues/925

subhadeepkaran commented 4 years ago

@Zepharchit by now you might have resolved possibly. but you may give it a try https://github.com/googlecolab/colabtools/issues/925#issuecomment-633889012