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

Tensorflow 1.15 Installation Problem in python 3.8+ version #25

Open
Dhyani01 opened this issue Jun 11, 2021 · 3 comments
Open

Tensorflow 1.15 Installation Problem in python 3.8+ version #25

Dhyani01 opened this issue Jun 11, 2021 · 3 comments

Comments

@Dhyani01
Copy link

If your python version is 3.7 or less this requirement.txt installation will work great,
Those who have python version 3.8+ will face some issues while installing Keras 1.15

For Python version 3.8+ first, install TensorFlow by

pip install tensorFlow

it will install TensorFlow version 2.5
Do these following steps in order to make the project working :

  1. Replace this line graph = tf.get_default_graph() by graph= tf.compat.v1.get_default_graph() in deeplearning.py
  2. Remove this import,

from keras.models import load_model

by this.

from tensorflow import keras

  1. Model is loaded in deeplearning.py instead load it inside the working code

with graph.as_default():
model = tf.keras.models.load_model('AlexNetModel.hdf5')
prediction = model.predict(image_array)

4: The code is using Keras library for importing images you can now import it by Image library.

comment this line# img = image.load_img('sample_image.png', target_size=(224, 224))
comment this line# img = image.img_to_array(img)
comment this line# img = np.expand_dims(img, axis=0)
comment this line# img = img/255
comment this line# print(type(img))
comment this line# img = tf.keras.preprocessing.image.array_to_img(img_data)

Now replace those lines by these lines :

input_image=Image.open("sample_image.png")
input_image = input_image.resize((224,224), resample=Image.LANCZOS)
image_array=np.array(input_image)
image_array=image_array.astype('float32')
image_array/=255
image_array=image_array.reshape(1,224,224,3)

These steps will fix your code according to the version.

@garudaonekh
Copy link

Hello,
Can you provide more detail on step4? I got stuck when I upload image, it errors with Image library.

@Dhyani01
Copy link
Author

Dhyani01 commented Apr 8, 2022

@garudaonekh If you have done all the steps from 1 to 3 correctly. Then for step 4 go to view.py inside plant_app folder and replace those lines above with the new ones.

@ramyaperumandla24
Copy link

@Dhyani01 @saroz014 @garudaonekh
Screenshot (17)

I am facing this issue after clicking on predict button, can u please help with this?

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

3 participants