Skip to content
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

Broken keras imports #124

Open
b-hemanth opened this issue Feb 23, 2023 · 1 comment
Open

Broken keras imports #124

b-hemanth opened this issue Feb 23, 2023 · 1 comment

Comments

@b-hemanth
Copy link

b-hemanth commented Feb 23, 2023

Attempting to use model_type=vision breaks due to outdated imports with error:

ImportError: cannot import name 'img_to_array' from 'keras.preprocessing.image'

in line 7 of pdftotree/pdftotree/visual/visual_utils.py, likely because these imports have moved to tf.keras.utils a la here and here. And as per the changelog, on 2020-10-13 ptt has upgraded Keras to 2.4.0 or later (and TensorFlow 2.2 or later). (#86, [@HiromuHota][HiromuHota]).

But, when I tried to make this edit locally and compile the package myself from the 0.5.1+dev channel, the kernel crashed, so leaving this as an issue here.

Environment:

  • OS: macOS Ventura 13.0
  • pdftotree Version: v0.5.0
  • pdfminer.six Version: 20221105
  • python Version: 3.10.4
@HiromuHota
Copy link
Contributor

According to https://stackoverflow.com/a/72613445, TF/Keras moved that function in 2.9.0.
Please manually install keras<2.9 (and the tensorflow compatible with this version of Keras), and try again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants